Correct cardinality function