Fix msvc warnings (add explicit casts)