review, fix some memory leak