Adjustments for subdirectory serving
diff --git a/dev/js/src/init.js b/dev/js/src/init.js
index bf7c206..7938a9e 100644
--- a/dev/js/src/init.js
+++ b/dev/js/src/init.js
@@ -16,6 +16,23 @@
 	     domReady,
 	     hintArray,
 	     alertifyClass) {
+
+  // Set hint array for hint helper
+  KorAP.hintArray = hintArray;
+
+  // Override KorAP.log
+  window.alertify = alertifyClass;
+  KorAP.log = function (type, msg) {
+
+    // Use alertify to log errors
+    alertifyClass.log(
+      (type === 0 ? '' : type + ': ') +
+	msg,
+      'error',
+      5000
+    );
+  };
+
   domReady(function (event) {
     var obj = {};
 
@@ -147,21 +164,6 @@
     // tutorial pages as well!
     obj.hint = hintClass.create();
 
-    // Set hint array for hint helper
-    KorAP.hintArray = hintArray;
-
-    // Override KorAP.log
-    KorAP.log = function (type, msg) {
-
-      // Use alertify to log errors
-      alertifyClass.log(
-	(type === 0 ? '' : type + ': ') +
-	  msg,
-	'error',
-	5000
-      );
-    };
-
     return obj;
   });
 });