fixes for invalid characters