fix some memory leak.