fixed a memory leak in the btree