improved checkPredicate code.