added wait after bringing to fg, found problem that immediately after a ^C, the wait does not actually wait for the child process to end. Needs to be fixed.