Fixes in queries
Merge pull request #1920 from anandpdoshi/anand-july-9

Fixes in queries