Fixing QueryBuilder bug