Win32 fixes from stable branch.