         else
           new_data = data
 
-        # insert into database must happen first to get site _id
+
+        # insert into database must happen first to get site _id        
         db.get('sites').insert data, (err, site) ->
+
           throw err if err
           log site
 

          users: {}
        }

        # add self as admin
        data.users[config.user._id] = 'admin'

        setup_config = getCustomSetupConfig pkg_id, pkg_version
        # add self as admin
        data.users[config.user.id] = 'admin'

        # handle null case
        if setup_config

        throw err if err
        exit('slug is already taken. please choose another') if site

       
        data = {
          created: Date.now()
          data:
            collections: {}
            header: {}
            footer: {}
            style: {}
