Changes to (almost) compile in windows