Remove iterator end query and fix Btree test code