Fixed some MySQL specific bugs