improvements to make this working on windows