fixing the queries to make sure we get the right data