Add support for running unit tests on Windows
Fix infinite loop bug when using repeated index vars