use explicit casts to mitigate MSVC warnings