Implement "wait" in the process manager + fix bug in kill reply handler.