removing invalid characters