fixed query engine errors