Improved Integrity Check

Improved the integrity check to prevent the user from over-flowing
levelCount.