fixed bug in query building
Merge pull request #8 from massiveart/bugfix/query-building

fixed bug in query building