Some fixes to get win32/msvc working