fix some casts