fix where clauses