fixing some queries for users with mysql in strict mode