             else if x[0] == MARKERS.output
                 marks = cm.findMarksAt({line:line, ch:1})
                 if marks.length == 0
-                    @mark_output_line(line)
+                    @mark_output_line(cm, line)
                 mark = cm.findMarksAt({line:line, ch:1})[0]
                 uuid = cm.getRange({line:line,ch:1}, {line:line,ch:37})
-                if mark.uuid != uuid # uuid changed -- completely new output
+                if mark? and mark.uuid != uuid # uuid changed -- completely new output
                     #console.log("uuid change: new x = ", x)
                     mark.processed = 38
                     mark.uuid = uuid
                     @elt_at_mark(mark).html('')
-                if mark.processed < x.length
+                if mark? and mark.processed < x.length
                     #console.log("length change; x = ", x)
                     # new output to process
                     t = x.slice(mark.processed, x.length-1)


            if x[0] == MARKERS.cell
                marks = cm.findMarksAt({line:line, ch:1})
                if marks.length == 0
                    @mark_cell_start(line)
                else
                    first = true
                    for mark in marks

        # starts with a cell or output marker and is not already marked.
        # If not marked, mark it appropriately, and possibly process any
        # changes to that line.
        @_process_sage_updates(@codemirror, start)
        if @editor._split_view
            @_process_sage_updates(@editor.codemirror1, start)

    _process_sage_updates: (cm, start) =>

        if not start?
            start = 0

