Temporary fix for race condition in waitpid()