anchor.diff:  del_(Obj, <<"-">>) when is_list(Obj) ->
       {ok, lists:droplast(Obj)};
   
  -del_(Obj, Field) when is_list(Obj) andalso is_integer(Field) ->
  +del_(Obj, Field) when is_list(Obj) andalso is_integer(Field)
  +                      andalso length(Obj) >= Field andalso Field >= 0->
       Result = case lists:split(Field, Obj) of
                    {[], [_|T]} -> T;
                    {H1, [_|T]} -> H1 ++ T;
  
positive.code: set_(Obj, Field, Value) when ?IS_DICT(Obj) ->
      {ok, set_element(Obj, Field, Value)};
  
  set_(Obj, Field, Value) when is_list(Obj) andalso is_integer(Field) ->
      Result = case lists:split(Field, Obj) of
                   {[], [_|T]} -> [Value] ++ T;
                   {H1, [_|T]} -> H1 ++ [Value] ++ T;
  
negative.code:         {error, Error} -> do_apply(Ops, Obj, [Error|Errors])
      end.
  
  % This will only match if you try to replace the whole document with an empty path
  % When strictly following the RFC, Val is allowed to be anything. However,
  % if it is not a valid JSON than the result is not a JSON as well which we want
  % to prevent in our use case.
  add(_Obj, [], Val) when ?IS_DICT(Val)->
      {ok, Val};
  add(Obj, [], Val) ->
      {error, {cantset, Obj, [], Val}};
  add(Obj, [Field], Val) ->
      add_(Obj, Field, Val);
  
  