fix memory leak(issue #5)