change some casts
merge fix