I believe this might be the affending line.  You've trickled down the CastExp* list and got the right 'ex' Expression to use, but not actually using it's value.