Fix crash on Windows when --enable-stats is set