correct schoolboy error; cast check is inverted