fixed exit status saving