Fixing windows build
And a few other fixes