fix infinite loop on windows