fixed query functions