anchor.diff:      ChildIndex := GetChildIndex(PTrieBranchNode(Node), GetBitFieldIndex(Hash, TrieDepth - 1));
       inc(FCount);
     end;
  -  if WasNodeBusy and (FDuplicatesMode = dmNotAllow) then
  -    CheckForDuplicates;
  +  if WasNodeBusy and (FDuplicatesMode in [dmNotAllow, dmReplaceExisting]) and
  +     CheckForDuplicatesOrReplaceNode then
  +  begin
  +    Result := False;
  +    exit;
  +  end;
     AllocNewKVPAndAddToList;
     Result := True;
  -end;
  -
  -function THashTrie.AttemptReplaceObject(Key: Pointer; KeySize: Cardinal; Value:
  -    Pointer): Boolean;
  -var
  -  kvp : PKeyValuePair;
  -  AChildIndex : Byte;
  -  HashTrieNode : PHashTrieNode;
  -begin
  -  kvp := InternalFind(Pointer(key), KeySize, HashTrieNode, AChildIndex);
  -  if kvp <> nil then
  -    begin
  -      if AutoFreeValue and (kvp^.Value <> nil) and (kvp^.Value <> Value) then
  -        FreeValue(kvp^.Value);
  -      kvp^.Value := Value;
  -      Result := True;
  -      exit;
  -    end;
  -  Result := False;
   end;
   
   function THashTrie.InternalFind(key: Pointer; KeySize: Cardinal; out
  
positive.code:   kvpNode : PKeyValuePairNode;
    WasNodeBusy : Boolean;
    ChildIndex : Byte;
    procedure CheckForDuplicates;
    begin
      kvpNode := PHashTrieNodeArray(Node^.Children)^[ChildIndex];
      while kvpNode <> nil do
      begin
        if CompareKeys(kvpNode^.KVP.Key, kvpNode^.KVP.KeySize, kvp.Key, kvp.KeySize) then
        begin
          if WasNodeBusy then
            dec(FCount); // Rollback prior addition of FCount
          RaiseDuplicateKeysNotAllowed;
        end;
        kvpNode := kvpNode^.Next;
      end;
    end;
    procedure AllocNewKVPAndAddToList;
    begin
  
negative.code:     inc(FStats.TotalMemAllocated, sizeof(TKeyValuePairNode));
    end;
  begin
    CalcHash(Hash, kvp.Key, kvp.KeySize);
    inherited Add(Hash, PTrieLeafNode(Node), WasNodeBusy);
    if not WasNodeBusy then
  