fixbug: fix memory leak issues