some fixes to compile on Windows