anchor.diff:      dump_internal2(DB, EndIndex, CurrentTime, Rest, FunExist, FunNotExist);
   dump_internal(DB, IndexToFetch, EndIndex, CurrentTime, Rest, FunExist, FunNotExist) ->
       NewRest = dump_internal2(DB, IndexToFetch, CurrentTime, Rest, FunExist, FunNotExist),
  -    Count = DB#rrd.count,
  -    dump_internal(DB, (IndexToFetch + 1) rem Count, EndIndex,
  +    dump_internal(DB, (IndexToFetch + 1) rem DB#rrd.count, EndIndex,
                     CurrentTime + DB#rrd.slot_length, NewRest, FunExist, FunNotExist).
   
   dump_internal2(DB, CurrentIndex, CurrentTime, Rest, FunExist, FunNotExist) ->
  -    Data = DB#rrd.data,
       From = CurrentTime,
       To = CurrentTime + DB#rrd.slot_length,
  -    case array:get(CurrentIndex, Data) of
  +    case array:get(CurrentIndex, DB#rrd.data) of
           undefined -> case FunNotExist(DB, From, To) of
                            ignore -> Rest;
                            {keep, X} -> [X | Rest]
  
positive.code: get_current_time(DB) ->
      DB#rrd.current_time.
  
  %% @doc If SlotOffset is 0, gets the current value, otherwise the value in a
  %%      previous slot the given offset away from the current one.
  -spec get_value(DB::rrd(), SlotOffset::non_neg_integer()) -> undefined | data_type().
  get_value(DB, 0) ->
      array:get(DB#rrd.current_index, DB#rrd.data); % minor optimization
  get_value(DB, SlotOffset) ->
      Index = (DB#rrd.current_index + SlotOffset) rem DB#rrd.count,
      array:get(Index, DB#rrd.data).
  
  
negative.code: 
  % internal API for the monitor process
  -export([get_slot_start/2, reduce_timeslots/2, add_nonexisting_timeslots/2,
           get_type/1, get_slot_length/1, get_current_time/1,
           get_value/2, get_value_by_offset/2,
           add_with/4, timing_with_hist_merge_fun/3]).
  
  % misc
  