move the wait_for_forks inside the loop.