Fixing bugs with querying.