fix memory leak, pointed out by syntion