diff --git a/authority/server/wsapi.js b/authority/server/wsapi.js
index dbe09145cb195f9a186ef9512431ce81e29d3ea1..2c92b61c27a2e4804ed92c92887b60549db851aa 100644
--- a/authority/server/wsapi.js
+++ b/authority/server/wsapi.js
@@ -158,7 +158,7 @@ exports.set_key = function (req, resp) {
 
 exports.am_authed = function(req,resp) {
   logRequest("am_authed", req.session);
-  httputils.jsonResponse(resp, (typeof req.session.authenticatedUser === 'string'));
+  httputils.jsonResponse(resp, isAuthed(req));
 };
 
 exports.sync_emails = function(req,resp) {
diff --git a/authority/static/dialog/main.js b/authority/static/dialog/main.js
index 0d6058fbf267cb27f7da9a57cc51aebd7a8b27e3..cce7089fbb9d71fcfc8eedcf4157b85a4d5bf542 100644
--- a/authority/static/dialog/main.js
+++ b/authority/static/dialog/main.js
@@ -51,7 +51,11 @@
     // sent list, and also may include identities registered on other devices.
     // we'll go through the list and generate new keypairs
     var identities = { };
-    var emails = JSON.parse(window.localStorage.emails);
+    var emails = {};
+    if (window.localStorage.emails) {
+      emails = JSON.parse(window.localStorage.emails);
+    }
+
     for (var e in emails) {
       if (!emails.hasOwnProperty(e)) continue;
       identities[e] = emails[e].pub;