fix memory manager.