anchor.diff:              Reason = proplists:get_value(<<"reason">>, Props),
               {{Id, Rev}, {ErrId, Reason}}
           end, ErrorsJson),
  -    receive
  -    {docs_remaining, 0} ->
  -        {ok, lists:flatten([ErrorsList|ErrorsAcc])};
  -    {docs_remaining, N} ->
  -        MoreDocs = lists:nthtail(length(Docs)-N, Docs),
  -        write_docs(Db, MoreDocs, [ErrorsList|ErrorsAcc])
  -    end;
  -write_docs(Db, Docs, _) ->
  +    {ok, ErrorsList};
  +write_docs(Db, Docs) ->
       couch_db:update_docs(Db, Docs, [], replicated_changes).
  
positive.code:         writer_loop(Parent, Reader, Target)
      end.
  
  write_docs(#http_db{} = Db, Docs, ErrorsAcc) ->
      ErrorsJson = couch_rep_httpc:request(Db#http_db{
          resource = "_bulk_docs",
          method = post,
          body = {fun upload_docs/1, {start, self(), Docs}},
          headers = [{"transfer-encoding", "chunked"} | Db#http_db.headers]
      }),
      ErrorsList =
      lists:map(
          fun({Props}) ->
  
negative.code:         ok;
      {HighSeq, Docs} ->
          DocCount = length(Docs),
          try write_docs(Target, Docs) of
          {ok, []} ->
              Parent ! {update_stats, docs_written, DocCount};
          {ok, Errors} ->
  