fixed exit code check