Added workaround for loop stalling on Windows

Issue #6