idtree: fix overflow for v. large ids on allocation and removal