Fix memory.chart write error