Fix issue #1203

Fixes issue #1203, and documents/improves the readability of the isCastable and semCast procedures.