diff --git a/fonts.js b/fonts.js
index 9ba1d876e..7d51e2c4b 100755
--- a/fonts.js
+++ b/fonts.js
@@ -1291,6 +1291,10 @@ var Font = (function Font() {
                  window.btoa(data) + ');');
       var rule = "@font-face { font-family:'" + fontName + "';src:" + url + '}';
       var styleSheet = document.styleSheets[0];
+      if (!styleSheet) {
+        document.documentElement.firstChild.appendChild( document.createElement('style') );
+        styleSheet = document.styleSheets[0];
+      }
       styleSheet.insertRule(rule, styleSheet.cssRules.length);
 
       return rule;
diff --git a/pdf.js b/pdf.js
index 5a193fe89..37afdc376 100644
--- a/pdf.js
+++ b/pdf.js
@@ -3379,7 +3379,7 @@ var Page = (function() {
           } catch (e) {
             exc = e.toString();
           }
-          continuation(exc);
+          if (continuation) continuation(exc);
         });
       };