Return the correct exit code