fixed an error in the query handling when disjointWiths are present