Fix bugs on Windows