Fixed a bug where findNecessaryBitwidth did not account for cardinalities