Fixed a few bugs in Windows