Attempted to fix memory leak