Modify chain encoding in branch_offset to avoid most cases of overflow.