I think if you make a variable (and set on it a reference of your character instead of cast) your problem will solve