Mysql compatability tests and fixes