fixed memory leak in Chart