anchor.diff:      lists:foldl(
         fun({ok, XSamplesInterval, XLastSampleTStamp, XStat},
             {ok, YSamplesInterval, YLastSampleTStamp, YStat}) ->
  +              XSamplesInterval = YSamplesInterval,
                 {ok,
  -               erlang:max(XSamplesInterval,
  -                          YSamplesInterval),
  -               erlang:max(XLastSampleTStamp,
  -                          YLastSampleTStamp),
  +               XSamplesInterval,
  +               %% usually are equal too except when one value is 0 (empty stats)
  +               erlang:max(XLastSampleTStamp, YLastSampleTStamp),
                  lists:map(fun({t, TStamps}) -> {t, TStamps};
                               ({Key, XVals}) ->
  -                                 case proplists:get_value(Key, YStat) of
  -                                     undefined -> {Key, XVals};
  -                                     YVals when length(XVals) == length(YVals) ->
  -                                         {Key, lists:zipwith(
  -                                                 fun(A, B) -> A + B end,
  -                                                 XVals, YVals)};
  -                                     _ -> {Key, XVals}
  -                                 end
  +                                 YVals = proplists:get_value(Key, YStat),
  +                                 {Key, sum_stats_values(XVals, YVals)}
                           end,
                           XStat)}
         end,
  
positive.code:                  deltas([10, 10, 11, 12, 12])),
      ok.
  
  -endif.
  
  % too much typing to add this, and I'd rather not hide the response too much
  
negative.code:         dict:to_list(TopKeys)),
      {ok, TopKeyList}.
  
  sum_stats_values_rec([], [], Rec) ->
      Rec;
  sum_stats_values_rec([], YVals, Rec) ->
      lists:reverse(YVals, Rec);
  sum_stats_values_rec(XVals, [], Rec) ->
      lists:reverse(XVals, Rec);
  sum_stats_values_rec([X | XS], [Y | YS], Rec) ->
      sum_stats_values_rec(XS, YS, [X+Y | Rec]).
  
  sum_stats_values(XVals, YVals) ->
      sum_stats_values_rec(lists:reverse(XVals), lists:reverse(YVals), []).
  
  get_buckets_stats(PoolId, BucketIds, Params) ->
      [FirstStats | RestStats] =
          lists:map(fun(BucketId) ->
  