Fix waitpid() and kill() behavior