Some fixes to make it compile in Visual Studio 2013