add more checking to handle MySQL strict mode