fix btree bugs