fix some bugs, some work on btree.