Fixed stats write error