       response.on "end", () ->
         console.log "file download complete", response.statusCode
         if response.statusCode is 200
-          console.log "chdirpath", kitePath
-          process.chdir kitePath
-          
-          cmd = spawn "unzip", ["#{name}.zip"]
+          cmd = spawn "unzip", [ path.join(@kitesPath, "#{kiteName}.zip"), "-d", @kitesPath]
           console.log 'unziping kite'
           
           cmd.stdout.on 'data', (data) ->

          
          cmd.on 'close', (code) ->
            console.log 'unzip process exited with code ', code
            fs.chmodSync path.join(kitePath, "foobar.kite"), "0777"
            fs.chown kitePath, 500000, 500000
            callback()

  runKite: () ->

    kiteInLxc = path.join "/opt", "kites", "foobar.kite"
    runner    = path.join(@lxc.pathToContainers, @lxc.name, "overlay", "opt", "runner")
    fs.writeFileSync runner, "#!/bin/bash -l \n export HOME=/root \n /usr/sbin/kd.sh #{kiteInLxc} > /tmp/kd.out & \n"
    fs.chmodSync runner, "0777"
    cmd = spawn "/usr/bin/lxc-start", ["-d", "-n", @name]
    
    cmd.stdout.on 'data', (data) ->

    @kitePath = path.join @lxc.pathToContainers, @lxc.name, "overlay", "opt", "kites"

  downloadAndExtractKite: (callback) ->
    {kitePath, zipUrl, kiteName} = this
    fs.mkdirsSync(kitePath) ## TODO mkdir creates 0777, exists check
    
    filepath = path.join kitePath, "#{kiteName}.zip"
    file     = fs.createWriteStream filepath

    console.log "downloading url", zipUrl, " to ", filepath
