Fix a bug on Windows which cause a crash.