fix a memory leak issue