fixed TypeMismatches through casts

this fixed a compile error for me.
I don't know if it is any help ...