anchor.diff:      case is_current_slot(Time, CurrentTime, SlotLength) of
           true ->
               CurrentIndex = DB#rrd.current_index,
  -            update_with(DB, CurrentIndex, Time, Value, F);
  +            Data = DB#rrd.data,
  +            case array:get(CurrentIndex, Data) of
  +                undefined ->
  +                    DB#rrd{data = array:set(CurrentIndex, F(Time, undefined, Value), Data)};
  +                OldValue ->
  +                    DB#rrd{data = array:set(CurrentIndex, F(Time, OldValue, Value), Data)}
  +            end;
           _ ->
               case is_future_slot(Time, CurrentTime, SlotLength) of
                   true ->
                       Count = DB#rrd.count,
                       CurrentIndex = DB#rrd.current_index,
  +                    Data = DB#rrd.data,
                       FillPolicy = DB#rrd.fill_policy,
                       Delta = (Time - CurrentTime) div SlotLength,
  -                            NewIndex = (CurrentIndex + Delta) rem Count,
  +                    NewIndex = (CurrentIndex + Delta) rem Count,
                       FilledData =
                           case Delta > Count of
                               true when FillPolicy =:= set_undefined ->
  
positive.code:                                 array:new(Count);
                              true ->
                                  % fill everything:
                                  fill(DB#rrd.data, FillPolicy, Count,
                                       (CurrentIndex + 1) rem Count,
                                       CurrentIndex,
                                       array:get(CurrentIndex, DB#rrd.data));
                              _ ->
                                  fill(DB#rrd.data, FillPolicy, Count,
                                       (CurrentIndex + 1) rem Count,
                                       NewIndex,
                                       array:get(CurrentIndex, DB#rrd.data))
                          end,
                      DB#rrd{data = array:set(NewIndex, F(Time, undefined, Value), FilledData),
                             current_index = NewIndex,
  
negative.code:                    StepSize::timespan(), CurrentSlot::non_neg_integer(),
                     SlotCount::pos_integer()) -> non_neg_integer()| future | past.
  time2slotidx(Time, CurrentTime, StepSize, CurrentSlot, SlotCount) ->
      case is_current_slot(Time, CurrentTime, StepSize) of
          true -> CurrentSlot;
          _ ->
              case is_future_slot(Time, CurrentTime, StepSize) of
                  true -> future;
                  _ ->
                      SlotOffset = SlotCount + (Time - CurrentTime) div StepSize,
                      if SlotOffset > 0 -> (CurrentSlot + SlotOffset) rem SlotCount;
                         true           -> past
                      end
  