Fixed the queries