better solution for exit code