fix some memory leak issue