fixed memory leak bug