Returning proper exit code