anchor.diff:      {lists:keysort(#app.name, Acc), Status}.
   
   merge_escript_app(AppName, Dir, Info, Mods, Apps, OldApps, Status) ->
  -    case lists:keysearch(AppName, #app.name, OldApps) of
  -        {value, App} ->
  -            ok;
  -        false ->
  -	    App = default_app(AppName, Dir)
  -    end,
  -    App2 = App#app{is_escript = true,
  -		   label = filename:basename(Dir, ".escript"),
  -		   info = Info,
  -		   mods = Mods,
  -		   active_dir = Dir,
  -		   sorted_dirs = [Dir]},
  -    case lists:keysearch(AppName, #app.name, Apps) of
  -        {value, _} ->
  +    App1 = case lists:keyfind(AppName, #app.name, OldApps) of
  +	       #app{} = App ->
  +		   App;
  +	       false ->
  +		   default_app(AppName, Dir)
  +	   end,
  +    App2 = App1#app{is_escript = true,
  +		    label = filename:basename(Dir, ".escript"),
  +		    info = Info,
  +		    mods = Mods,
  +		    active_dir = Dir,
  +		    sorted_dirs = [Dir]},
  +    case lists:keymember(AppName, #app.name, Apps) of
  +        true ->
               Error = lists:concat([AppName, ": Application name clash. ",
                                     "Escript ", Dir," contains application ",
   				  AppName, "."]),
  
positive.code: read_apps(C, Sys, [#app{mods = Mods, is_included = IsIncl} = A | Apps], Acc) ->
      {Mods2, IsIncl2} = read_apps(C, Sys, A, Mods, [], IsIncl),
      Status =
          case lists:keysearch(missing, #mod.status, Mods2) of
              {value, _} -> missing;
              false      -> ok
          end,
      UsesMods = [M#mod.uses_mods || M <- Mods2, M#mod.is_included =:= true],
      UsesMods2 = lists:usort(lists:flatten(UsesMods)),
  
negative.code: 
  patch_erts_version(RootDir, Apps, Status) ->
      AppName = erts,
      case lists:keyfind(AppName, #app.name, Apps) of
          #app{vsn = Vsn} = Erts ->
              LocalRoot = code:root_dir(),
              if
                  LocalRoot =:= RootDir, Vsn =:= "" ->
                      Vsn2 = erlang:system_info(version),
  