fix memory leak, and custom node allocator