     for cell in imported.cells
       if cell.type is 'input'
         if options.run
-          run_in_available_context cell.value
+          run_in_available_context notebook, cell.value
         else
           add_context notebook, cell.value
+    notebook
 
   clear_notebook = (notebook) ->
     notebook.$document.empty()


  export_notebook = (current_cell) ->
    lead_js_version: 0
    cells: current_cell.notebook.cells.filter((cell) -> cell != current_cell).map (cell) ->
      type: 'input'
      value: cell.editor.getValue()


      catch e
        handle_exception e, compiled

    output_cell

  opening_run_context = null

