Fix some build issues with msvc