fix memory relese bug