Fixed a segfault when waitpid returned 0