Update query_models.py

Fixed some bugs