fixed up to support CompareRelation.