fix SIGSEGV in windows

Issue #2206