Modifed some code to build on windows