anchor.diff:    begin
       SaveStream.PlaceMarker('OfferToDemandCache');
       SaveStream.Write(fOfferToDemandCache.Count);
  -    for Item in fOfferToDemandCache do
  -    begin
  -      SaveStream.Write(Item.Key.FromUID);
  -      SaveStream.Write(Item.Key.ToUID);
  -      SaveStream.Write(Item.Value);
  +
  +    Comparer := nil; //RESET to nil. Obligatory!
  +
  +    if (fOfferToDemandCache.Count > 0) or (fSerfToOfferCache.Count > 0) then
  +      Comparer := TKMDeliveryBidKeyComparer.Create;
  +
  +    if fOfferToDemandCache.Count > 0 then
  +    begin
  +      CacheKeyArray := fOfferToDemandCache.Keys.ToArray;
  +      TArray.Sort<TKMDeliveryBidKey>(CacheKeyArray, Comparer);
  +
  +      for Key in CacheKeyArray do
  +      begin
  +        SaveStream.Write(Key.FromUID);
  +        SaveStream.Write(Key.ToUID);
  +        SaveStream.Write(fOfferToDemandCache.Items[Key]);
  +      end;
       end;
   
       SaveStream.PlaceMarker('SerfToOfferCache');
       SaveStream.Write(fSerfToOfferCache.Count);
  -    for Item in fSerfToOfferCache do
  -    begin
  -      SaveStream.Write(Item.Key.FromUID);
  -      SaveStream.Write(Item.Key.ToUID);
  -      SaveStream.Write(Item.Value);
  -    end;
  +
  +    if fSerfToOfferCache.Count > 0 then
  +    begin
  +      CacheKeyArray := fSerfToOfferCache.Keys.ToArray;
  +      TArray.Sort<TKMDeliveryBidKey>(CacheKeyArray, Comparer);
  +
  +      for Key in CacheKeyArray do
  +      begin
  +        SaveStream.Write(Key.FromUID);
  +        SaveStream.Write(Key.ToUID);
  +        SaveStream.Write(fSerfToOfferCache.Items[Key]);
  +      end;
  +    end;
  +
  +    if Comparer <> nil then
  +      Comparer.Free;
     end;
     {$ENDIF}
   end;
  
positive.code: constructor TKMDeliveries.Create(aHandIndex: TKMHandID);
  {$IFDEF USE_HASH}
  var
    CacheKeyComparer: TKMDeliveryBidKeyComparer;
  {$ENDIF}
  begin
    fOwner := aHandIndex;
    {$IFDEF USE_HASH}
    if CACHE_DELIVERY_BIDS then
    begin
      CacheKeyComparer := TKMDeliveryBidKeyComparer.Create;
      fOfferToDemandCache := TDictionary<TKMDeliveryBidKey, Single>.Create(CacheKeyComparer);
      fSerfToOfferCache := TDictionary<TKMDeliveryBidKey, Single>.Create(CacheKeyComparer);
    end;
  
negative.code: 
  {$IFDEF USE_HASH}
  { TKMDeliveryBidKeyComparer }
  function TKMDeliveryBidKeyEqualityComparer.Equals(const Left, Right: TKMDeliveryBidKey): Boolean;
  begin
    Result := (Left.FromUID = Right.FromUID) and (Left.ToUID = Right.ToUID);
  end;
  