fixed the bug in the queries.py causing incorrect json to be returned