fix some bug for mysql sql