Fix crash if not returning expected class.