WIN32 fixes and debugging helpers