tried to fix memory leak