Improve fix for WHERE clauses