added a CheckRule util function