fixes for running with mysqldb