bug fix in Query.py