cas/btree: Fixed some edge cases