fixed bug in query generation