replace invalid characters