Rework unit type-checking