Use Locator.replace instead of converting to string.