windows fixes and some logging