Fix cast -> variable typing bug