Fix a few bugs checking subtype ranges