minor bug fixes during tests/querytest.py
starting unit tests