Fix some queries
Merge pull request #1 from lmivan/master

Fix some queries