Modified the check logic.