Fixed potential infinite loop on win.