fix bugs for mysql