add extra check for query formulation