fixed exit status code checking