Added hacks to make it run on visual studio.