MSVC compatibility fixes.

20 files changed