anchor.diff:      {Rec, Failed} = Acc,
       {Rec, [{5014, Avp#diameter_avp{data = Data}} | Failed]};
   
  -pack_AVP(Name, #diameter_avp{is_mandatory = M} = Avp, Acc) ->
  -    case pack_arity(Name, M) of
  +pack_AVP(Name, #diameter_avp{is_mandatory = M, name = AvpName} = Avp, Acc) ->
  +    case pack_arity(Name, AvpName, M) of
           0 ->
               {Rec, Failed} = Acc,
               {Rec, [{if M -> 5001; true -> 5008 end, Avp} | Failed]};
  
positive.code:     %% packed into a dedicated field defeats that point. Note that we
      %% can't just test not is_failed() since this will be 'true' when
      %% packing an unknown AVP directly within Failed-AVP.
      case NF andalso M andalso is_strict() of
          true ->
              0;
          false ->
              avp_arity(Name, 'AVP')
      end.
  
  %% 3588:
  %%
  
negative.code:             pack(Arity, 'AVP', Avp, Acc)
      end.
  
  %% Give Failed-AVP special treatment since (1) it'll contain any
  %% unrecognized mandatory AVP's and (2) the RFC 3588 grammar failed to
  %% allow for Failed-AVP in an answer-message.
  
  pack_arity(Name, AvpName, M) ->
      IsFailed = Name == 'Failed-AVP' orelse is_failed(),
  
      %% Not testing just Name /= 'Failed-AVP' means we're changing the
      %% packing of AVPs nested within Failed-AVP, but the point of
      %% ignoring errors within Failed-AVP is to decode as much as
  