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: 	    end,
  	    NewSys2 = NewSys#sys{apps = lists:sort(Apps),
  				 rels = lists:sort(Rels)},
  	    case lists:keysearch(NewSys2#sys.boot_rel,
  				 #rel.name,
  				 NewSys2#sys.rels) of
  		{value, _} ->
  		    {NewSys2, Status2};
  		false ->
  		    Text2 = lists:concat(["Release " ++ NewSys2#sys.boot_rel,
  
negative.code:     %% Initate app
      Apps2 = sort_app_dirs(Apps),
      Apps4 =
          case lists:keyfind(Name, #app.name, Apps) of
              false ->
                  case lists:keyfind(Name, #app.name, OldApps) of
                      false ->
                          App = default_app(Name, Dir),
                          [App | Apps2];
                      #app{active_dir = Dir} = OldApp ->
                          [OldApp | Apps2];
                      OldApp ->
                          App =
                              case filter_app(OldApp) of
                                  {true, NewApp} ->
  