fixed some queries