Small fixes in some of the queries