Return proper exit code