Fix index bug on Windows