Fix to pass all query tests