use waitpid correctly?