anchor.diff:          % NOTE vmx (2010-12-07): changed seedtree_write/3 to use insert height.
           %{ok, NodesList, NewHeight} = seedtree_write(Fd, Seedtree2,
           %        InsertHeight-HeightDiff),
  +        %{ok, NodesList, NewHeight, NewHeightDiff} = seedtree_write(
  +        %        Fd, Seedtree2, InsertHeight-HeightDiff),
  +        % NOTE vmx (20101217): instead of using (InsertHeight-HeightDiff) as
  +        %     height, we use (InsertHeight-Seedtree2#seedtree_root.height-1)
  +        %     as the seedtree might not have been created to the full height
  +        %     (which can happen due to reaching the leafs or
  +        %     MAX_SEEDTREE_HEIGHT earlier)
  +?myDebugVal(InsertHeight-HeightDiff),
  +?myDebugVal(InsertHeight-Seedtree2#seedtree_root.height+1),
           {ok, NodesList, NewHeight, NewHeightDiff} = seedtree_write(
  -                Fd, Seedtree2, InsertHeight-HeightDiff),
  +                Fd, Seedtree2, InsertHeight-Seedtree2#seedtree_root.height+1),
   
           % There was a node overflow. Though we are currently somewhere within
           % the tree, so we need to return a node that has the original height.
  
positive.code:     %HeightDiff = InsertHeight - (OmtHeight + 1),
      %HeightDiff = InsertHeight - OmtHeight,
      HeightDiff = InsertHeight - (OmtHeight - 1),
      %?debugVal(HeightDiff),
      NewChildrenPos2 = if
      % Input tree can be inserted as-is into the target tree
      HeightDiff == 0 ->
  
negative.code:     % First get the position of children of the not disjoint nodes
      NdChildrenPos = lists:append(
              [Children || {_Mbr, _Pos, Children} <- NotDisjoint]),
      %?myDebugVal(NdChildrenPos),
  
      % Get the position of the children of the nodes that will be inserted
      % as well.
      OmtChildren = load_nodes(Fd, OmtPosList),
      OmtChildrenPos = lists:append(
              [Children || {_Mbr, _Pos, Children} <- OmtChildren]),
      ?myDebugVal(length(OmtChildren)),
      %?myDebugVal(OmtChildrenPos),
  
      NewChildrenPos = NdChildrenPos ++ OmtChildrenPos,
      % Transform the new children's position to a tuple containing their MBR
  