reworked queries
minor fixing