return proper exit code