fixed query builder