Added changes from suggestions.
Use same check as in UrlAliasGenerator