     console.log "Marking app #{app.name} as broken because"
     console.log err.stack
 
-    app.state = "broken"
-    app.password = null
+    data =
+        state: 'broken'
+        password: null
     if err.result?
-        app.errormsg = err.message + ' :\n' + err.result
+        data.errormsg = err.message + ' :\n' + err.result
     else if err.message?
-        app.errormsg = err.message + ' :\n' + err.stack
+        data.errormsg = err.message + ' :\n' + err.stack
     else
-        app.errormsg = err
-    app.save (saveErr) ->
+        data.errormsg = err
+    app.updateAttributes data, (saveErr) ->
         return sendError res, saveErr if saveErr
 
         res.send

                            return

                        if result.drone?
                            appli.state = "installed"
                            appli.port = result.drone.port

                            msg = "install succeeded on port #{appli.port}"
                            console.info msg

                            appli.save (err) ->
                                return sendErrorSocket err if err?
                                icons.save appli, iconInfos, (err) ->
                                    if err? then console.log err.stack

        broken = (app, err) ->
            console.log "Marking app #{app.name} as broken because"
            console.log err.stack
            data =
                state: 'broken'
                password: null
            if err.result?
                data.errormsg = err.message + ' :\n' + err.result
            else
                data.errormsg = err.message + ' :\n' + err.stack
            app.updateAttributes data, (saveErr) ->
                console.log(saveErr) if saveErr?

        updateApps = (apps, callback) ->
