Fix bugs in Windows