anchor.diff:  
   
   procedure TKMScriptingIdCache.CacheGroup(aGroup: TKMUnitGroup; aUID: Integer);
  -var I: ShortInt;
  -begin
  -  for I := Low(fGroupCache) to High(fGroupCache) do
  -  if fGroupCache[I].UID = aUID then
  -    Exit; //Already in cache
  +var
  +  I: Integer;
  +begin
  +  for I := Low(fGroupCache) to High(fGroupCache) do
  +    if fGroupCache[I].UID = aUID then
  +    begin
  +      //Update cache item if changed (also from / to nil)
  +      if fGroupCache[I].G <> aGroup then
  +      begin
  +        gHands.CleanUpGroupPointer(fGroupCache[I].G);
  +        if aGroup <> nil then
  +          fGroupCache[I].G := aGroup.GetGroupPointer;
  +      end;
  +      Exit;
  +    end;
   
     //We need to release pointer if we remove group from cache
     if fGroupCache[fGroupLastAdded].G <> nil then
  
positive.code:   I: Integer;
  begin
    for I := Low(fUnitCache) to High(fUnitCache) do
      fUnitCache[I].U := gHands.GetUnitByUID(fUnitCache[I].UID);
  
    for I := Low(fHouseCache) to High(fHouseCache) do
      fHouseCache[I].H := gHands.GetHouseByUID(fHouseCache[I].UID);
  
    for I := Low(fGroupCache) to High(fGroupCache) do
      fGroupCache[I].G := gHands.GetGroupByUID(fGroupCache[I].UID);
  end;
  
  
  
negative.code: 
  { TKMScriptingIdCache }
  procedure TKMScriptingIdCache.CacheUnit(aUnit: TKMUnit; aUID: Integer);
  var
    I: Integer;
  begin
    for I := Low(fUnitCache) to High(fUnitCache) do
      //Update cache item if changed (also from / to nil)
      if fUnitCache[I].UID = aUID then
      begin
        if fUnitCache[I].U <> aUnit then
        begin
          gHands.CleanUpUnitPointer(fUnitCache[I].U);
          if aUnit <> nil then
            fUnitCache[I].U := aUnit.GetUnitPointer;
        end;
        Exit;
      end;
  
    //We need to release pointer if we remove unit from cache
    if fUnitCache[fUnitLastAdded].U <> nil then
  