Fixed some casts to remove warnings.