Some changes to improve compatibility with win32.