Fix bugs in windows build.