Fix segmentation fault on Windows