fixed bug in sigchld_handler