Fixed MSVC related bugs