                   # Counter created
 
                   hostnameAliases = JVM.createAliases {
-                    nickname:username
-                    type:'user', uid, groupSlug:'koding'
+                    nickname:username, uid,
+                    type:'user', groupSlug:group
                   }
 
                   JDomain.createDomains {
-                    account, stack,
+                    account, stack, group,
                     domains:hostnameAliases,
                     hostnameAlias:hostnameAliases[0]
                   }

    #     return callback err  if err
    #     callback null, [vm]

  # Private static method to fetch domains
  @fetchDomains = (selector, callback)->
    JDomain = require './domain'

      callback? err, vm  unless err

      handleError err

      return console.warn "Failed to create VM for ", {
        users, groups, hostnameAlias
      }  if err

      group = groupSlug

      JDomain.ensureDomainSettingsForVM {
        account, vm, type, nickname, group, stack
      }

      JDomain.createDomains {
        account, domains:hostnameAliases,
        group, hostnameAlias, stack
      }

      target.addVm vm, handleError

  wrapGroup = (group)-> [ { id: group.getId() } ]
