Fix an issue with the where clause and and mixing