Bug fixes for exit, wait, pipe and stat
More bug fixes for exit, wait, pipe and stat