Bug fixes for the refactoring to remove the regex.