return correct exit code