Fixed a heap corruption crash on Windows