improve memory leak