Return correct exit code