[CHANGED] returning correct exit code on exit