Fix windows specific bugs