fixed memory leak issue