RVM

Improve illegal upcast detection