Fixes to casting code.
Fixes to casting code.

fvpolpeta/devide,nagyistoce/devide,zhangfangyan/devide,zhangfangyan/devide,chrisidefix/devide,chrisidefix/devide,ivoflipse/devide,fvpolpeta/devide,ivoflipse/devide,nagyistoce/devide