More fixes to the queries