Fixes in queries