added some fixes for MSVC compiler