Some fixes in querry