Fixed some casts