 
     rs = fs.createReadStream '/proc/mounts', flags: 'r'
     rs.setEncoding()
+
     rs.on 'error', (err)->
       console.error error = "Unexpected error : couldn't retrieve mount info: #{err.message}"
       callback error
-    rs.on 'data',(data)->
+
+    rs.on 'data', (data)->
       if data.indexOf(options.mountpoint) isnt -1
         console.log "[OK] #{remotehost} is mounted for user #{username}"
         rs.destroy()

    @spawnWrapper '/sbin/fuser', ['-mk',options.mountpoint],(err,res)=>
      @spawnWrapper '/bin/umount', [options.mountpoint],(err, res)=>
        if err?
          log.error error = "[ERROR] can't umount #{options.mountpoint}: #{err}"
          callback error
        else
          log.info info = "[OK] directory #{options.mountpoint} umounted"
          @remountVE options,(err,res)=>
            if err
              callback err

              jsonConf = JSON.stringify res
              fs.writeFile cfg, jsonConf, 'utf-8',(err)->
                if err?
                  log.error error = "Couldn't update config #{cfg}: #{err.message}"
                  callback error
                else
                  log.info info = "Config successfully updated"
                  callback null, info
            else
              log.warn warn = "Config for #{remotehost} already exists"
              callback null, warn
      else
        jsonConf = JSON.stringify [newConf]
        fs.writeFile cfg, jsonConf, 'utf-8',(err)->
          if err?
            log.error error = "Couldn't update config #{cfg}: #{err.message}"
            callback error
          else
            fs.chmod cfg,'0600',(err)->
            log.info info = "Config successfully created"
            callback null, info

  # Safe
