fixed a few things with queries

Just a few things that had to get fixed