query controller fixes