Made a few more little fixes in the queries