anchor.diff:  	    Files = get_filenames(Node,MetaFile),
   	    lists:foreach(
   	      fun(File0) ->
  -		      %%Other nodes may still have different CWD
  -		      {ok, Cwd} = rpc:call(Node, file, get_cwd, []),
  -		      File1 = filename:join(Cwd, File0),
  -		      File = filename:join(Dir,filename:basename(File1)),
  -		      file:rename(File1,File)
  +                      case MetaFile of
  +                          {local, _, _} ->
  +                              File = filename:join(Dir,filename:basename(File0)),
  +                              file:rename(File0, File);
  +                          _ ->
  +                              %%Other nodes may still have different CWD
  +                              {ok, Cwd} = rpc:call(Node, file, get_cwd, []),
  +                              File1 = filename:join(Cwd, File0),
  +                              File = filename:join(Dir,filename:basename(File1)),
  +                              file:rename(File1,File)
  +                      end
   	      end,
   	      Files);
   	false ->
  
positive.code: 			  {ok,T} = dbg:get_tracer(N),
  			  rpc:call(N,seq_trace,set_system_tracer,[T]),
  			  dbg:trace_client(ip,{Host,Port},
  					   {fun ip_to_file/2,{file,File}}),
  			  {[{N,{local,File,Port},TF}|CS], [N|S]};
  		      Other ->
  			  display_warning(N,{cannot_open_ip_trace_port,
  					     Host,
  
negative.code: 		      NodeInfo),
  	    loop(NodeInfo, SessionInfo);
  	{nodedown,Node} ->
              NewState = make_node_dead(Node, NodeInfo, SessionInfo),
  	    loop(dict:erase(Node,NodeInfo), NewState);
          {noderesumed,Node,Reporter} ->
              {MetaFile, CurrentSuffix, NewState} = make_node_alive(Node, SessionInfo),
              fetch_partial_result(Node, MetaFile, CurrentSuffix),
              spawn(fun() -> resume_trace(Reporter) end),
              loop(NodeInfo, NewState);
  	{timeout, StopOpts} ->
  	    spawn(?MODULE, stop, [StopOpts]),
  	    loop(NodeInfo, SessionInfo);
          {node_overloaded, Node} ->
              io:format("Overload check activated on node: ~p.~n", [Node]),
              {Overloaded, SI} = {proplists:get_value(overloaded, SessionInfo, []),
                                  lists:keydelete(overloaded, 1, SessionInfo)},
  	    loop(NodeInfo, [{overloaded, [Node|Overloaded]} | SI]);
          {get_overloaded, Pid} ->
              Pid ! proplists:get_value(overloaded, SessionInfo, []),
              loop(NodeInfo, SessionInfo);
  	trace_started ->
  	    case proplists:get_value(timer, SessionInfo) of
  		undefined -> ok;
  		{MSec, StopOpts}  -> erlang:send_after(MSec, self(), {timeout, StopOpts})
  	    end,
  	    loop(NodeInfo, SessionInfo);
          flush_timeout ->
              [ dbg:flush_trace_port(Node) || Node <- dict:fetch_keys(NodeInfo) ],
              try_send_flush_tick(SessionInfo),
              loop(NodeInfo, SessionInfo);
  	{stop,nofetch,Sender} ->
              do_stop(nofetch, Sender, NodeInfo, SessionInfo);
  	{stop,FetchSpec,Sender} ->
              case proplists:get_value(shell, SessionInfo, false) of
                  only -> do_stop(nofetch, Sender, NodeInfo, SessionInfo);
                  _    -> do_stop(FetchSpec, Sender, NodeInfo, SessionInfo)
              end
      end.
  
  do_stop(nofetch, Sender, NodeInfo, _) ->
      write_config(?last_config, all),
      dict:fold(
        fun(Node,{_,MetaPid},_) ->
                rpc:call(Node,observer_backend,ttb_stop,[MetaPid])
        end,
        ok,
        NodeInfo),
      dbg:stop_clear(),
      ets:delete(?history_table),
      Sender ! {?MODULE, stopped};
  
  do_stop({FetchOrFormat, UserDir}, Sender, NodeInfo, SessionInfo) ->
      write_config(?last_config, all),
      Localhost = host(node()),
      Dir = get_fetch_dir(UserDir),
      file:make_dir(Dir),
      %% The nodes are traversed twice here because
      %% the meta tracing in observer_backend must be
      %% stopped before dbg is stopped, and dbg must
      %% be stopped before the trace logs are moved orelse
      %% windows complains.
      AllNodesAndMeta =
          dict:fold(
            fun(Node,{MetaFile,MetaPid},Nodes) ->
                    rpc:call(Node,observer_backend,ttb_stop,[MetaPid]),
                    [{Node,MetaFile}|Nodes]
            end,
            [],
            NodeInfo),
      dbg:stop_clear(),
      AllNodes =
          lists:map(
            fun({Node,MetaFile}) ->
                    spawn(fun() -> fetch_report(Localhost,Dir,Node,MetaFile) end),
                    Node
            end,
            AllNodesAndMeta),
      ets:delete(?history_table),
      wait_for_fetch(AllNodes),
      copy_partials(Dir, proplists:get_value(partials, SessionInfo)),
      Absname = filename:absname(Dir),
      case FetchOrFormat of
          fetch -> ok;
          {format, Opts} -> format(Dir, Opts)
      end,
      Sender ! {?MODULE,{stopped,Absname}}.
  
  make_node_dead(Node, NodeInfo, SessionInfo) ->
      {MetaFile,_} = dict:fetch(Node, NodeInfo),
      NewDeadNodes = [{Node, MetaFile} | proplists:get_value(dead_nodes, SessionInfo)],
      [{dead_nodes, NewDeadNodes} | lists:keydelete(dead_nodes, 1, SessionInfo)].
  
  make_node_alive(Node, SessionInfo) ->
              DeadNodes = proplists:get_value(dead_nodes, SessionInfo),
              Partials = proplists:get_value(partials, SessionInfo),
              {value, {_, MetaFile}, Dn2} = lists:keytake(Node, 1, DeadNodes),
              SessionInfo2 = lists:keyreplace(dead_nodes, 1, SessionInfo, {dead_nodes, Dn2}),
              {MetaFile, Partials + 1, lists:keyreplace(partials, 1, SessionInfo2, {partials, Partials + 1})}.
  
  try_send_flush_tick(State) ->
      case proplists:get_value(flush, State) of
          undefined ->
              ok;
          MSec ->
              erlang:send_after(MSec, self(), flush_timeout)
      end.
  
  get_fetch_dir(undefined) -> ?upload_dir ++ ts();
  get_fetch_dir(Dir) -> Dir.
  
  resume_trace(Reporter) ->
      ?MODULE:run_history(all_silent),
      Reporter ! trace_resumed.
  
  get_nodes() ->
      ?MODULE ! {get_nodes,self()},
  