             @setState(cell_list : cell_list)
         return
 
-    _syncdb_cell_change: (id, record) =>
+    _syncdb_cell_change: (id, new_cell) =>
         cells = @store.get('cells') ? immutable.Map()
         cell_list_needs_recompute = false
-        #@_client.dbg("_syncdb_cell_change")("#{id} #{JSON.stringify(record?.toJS())}")
-        if not record?
+        #@dbg("_syncdb_cell_change")("#{id} #{JSON.stringify(new_cell?.toJS())}")
+        old_cell = cells.get(id)
+        if not new_cell?
             # delete cell
-            if cells?.get(id)?
+            if old_cell?
                 obj = {cells: cells.delete(id)}
                 cell_list = @store.get('cell_list')
                 if cell_list?

        store.syncdb = syncdb
        @syncdb      = syncdb
        @_client     = client
        @_is_project = client.is_project()
        @_project_id = project_id
        @_path       = path
        @_directory  = misc.path_split(path)?.head

        #dbg = @_client.dbg("JupyterActions._init")

        f = () =>
            @setState(has_unsaved_changes : @syncdb?.has_unsaved_changes())

                @setState(obj)
        else
            # change or add cell
            old_cell = cells.get(id)
            if new_cell.equals(old_cell)
                return # nothing to do
            obj = {cells: cells.set(id, new_cell)}
            if not old_cell? or old_cell.get('pos') != new_cell.get('pos')
                cell_list_needs_recompute = true
            @setState(obj)
        if @_is_manager
            @manage_on_cell_change(id, new_cell, old_cell)
        return cell_list_needs_recompute

    _syncdb_change: (changes) =>
        do_init = @_is_manager and not @store.get('cells')?
        #console.log 'changes', changes, changes?.toJS()
        #@dbg("_syncdb_change")(JSON.stringify(changes?.toJS()))
        @set_has_unsaved_changes()
        cell_list_needs_recompute = false
        changes?.forEach (key) =>
