bug fix memory leak