diff --git a/IPython/frontend/html/notebook/handlers.py b/IPython/frontend/html/notebook/handlers.py
index ba0bfd2..2f23540 100644
--- a/IPython/frontend/html/notebook/handlers.py
+++ b/IPython/frontend/html/notebook/handlers.py
@@ -593,10 +593,7 @@ class NotebookRootHandler(AuthenticatedHandler):
km = self.application.kernel_manager
files = nbm.list_notebooks()
for f in files :
- nid = f['notebook_id']
- kid = km.kernel_for_notebook(nid)
- if kid is not None:
- f['kernel_id'] = kid
+ f['kernel_id'] = km.kernel_for_notebook(f['notebook_id'])
self.finish(jsonapi.dumps(files))
@web.authenticated
diff --git a/IPython/frontend/html/notebook/static/js/notebooklist.js b/IPython/frontend/html/notebook/static/js/notebooklist.js
index b7472ab..8e861b3 100644
--- a/IPython/frontend/html/notebook/static/js/notebooklist.js
+++ b/IPython/frontend/html/notebook/static/js/notebooklist.js
@@ -113,7 +113,7 @@ var IPython = (function (IPython) {
this.add_link(notebook_id, nbname, item);
if (!IPython.read_only){
// hide delete buttons when readonly
- if(kernel == undefined){
+ if(kernel == null){
this.add_delete_button(item);
} else {
this.add_shutdown_button(item,kernel);