       .map (user) -> user.instance
 
 
-
   reviveUsers: (options, callback = kd.noop) ->
 
     { storage } = kd.singletons.computeController
 
-    super options, (err, users = []) =>
-      return callback err  if err
-
-      debug 'reviveUsers', { users, machine: this }
-
-      machineUsers = @getAt('users').map (machineUser) ->
-        # find user instance matching the raw `machineUser` object.
-        userInstance = _.find users, (user) ->
-          user.profile.nickname is machineUser.username
-
-        # if there is a match, update raw `machineUser` object by attaching the
-        # revived instance to it with `instance` key.
-        if userInstance
-          machineUser.instance = userInstance
-
-        return machineUser
+    super options, (err, accounts = []) =>
+      return callback err  if err
+
+      debug 'reviveUsers', { accounts, machine: this }
+
+      machineUsers = @getAt 'users'
+
+      accounts.forEach (account) ->
+        machineUser = _.find machineUsers, (user) ->
+          user.username is account.profile.nickname
+
+        if machineUser
+        then machineUser.instance = account
+        else machineUsers.push {
+          username: account.profile.nickname
+          instance: account
+          permanent: yes
+        }
 
       @setAt 'users', machineUsers
 
       storage.machines.push this
 
-      callback null, users
+      callback null, accounts
 
 
   setLabel: (label, callback) ->


    debug 'unshare user', username

    new Promise (resolve, reject) =>
      remote.api.SharedMachine.kick @uid, [username], (err) =>
        promise = @getBaseKite()
          .klientUnshare { username, permanent: yes }
          .then => @reviveUsers { permanentOnly : yes }
          .then -> if err then reject new Error err else resolve()
          .catch reject



  shareUser: (username) ->



        @getBaseKite()
          .klientShare { username, permanent: yes }
          .then => @users.push { approved: no, permanent: yes, username, owner: no }
          .then => @reviveUsers { permanentOnly : yes }
          .then resolve
          .catch reject
