fixing a couple minor query bugs