Improved _is_unity as suggested by @mdboom