Fixed bugs for Windows