Fix some issues for msvc compile