anchor.diff:  add_links(Ctx, Key, TreeId, Links) when is_list(Links) ->
       datastore_apply(Ctx, Key, fun datastore:add_links/4, add_links, [TreeId, Links]);
   add_links(Ctx, Key, TreeId, Link) ->
  -    ?MODULE:hd(add_links(Ctx, Key, TreeId, [Link])).
  +    hd_if_list(add_links(Ctx, Key, TreeId, [Link])).
   
   %%--------------------------------------------------------------------
   %% @doc
  
positive.code: delete_links(Ctx, Key, TreeId, Links) when is_list(Links) ->
      datastore_apply(Ctx, Key, fun datastore:delete_links/4, delete_links, [TreeId, Links]);
  delete_links(Ctx, Key, TreeId, Link) ->
      ?MODULE:hd(delete_links(Ctx, Key, TreeId, [Link])).
  
  %%--------------------------------------------------------------------
  %% @doc
  
negative.code: %%--------------------------------------------------------------------
  %% @private
  %% @doc
  %% Gets head of the list if term is list or return term.
  %% @end
  %%--------------------------------------------------------------------
  -spec hd_if_list(term()) -> term().
  hd_if_list(List) when is_list(List) ->
      hd(List);
  hd_if_list(Term) ->
      Term.