modification to PyMySql and base