Fixed type cast for MSVC