Update waitpid loop