fixed some memory leak