diff --git a/js/extensions/googleAnalytics.js b/js/extensions/googleAnalytics.js
index 8adceb8d..64c55294 100644
--- a/js/extensions/googleAnalytics.js
+++ b/js/extensions/googleAnalytics.js
@@ -186,5 +186,18 @@ define([
         ]);
     };
 
+    // Log error messages
+    googleAnalytics.onError = function(error) {
+        if(_.isString(error) || !error.message) {
+            return;
+        }
+        _gaq.push([
+            '_trackEvent',
+            "Error",
+            "message",
+            error.message
+        ]);
+    };
+
     return googleAnalytics;
 });
\ No newline at end of file
diff --git a/js/fileMgr.js b/js/fileMgr.js
index 3d078fda..37947eb0 100644
--- a/js/fileMgr.js
+++ b/js/fileMgr.js
@@ -173,8 +173,8 @@ define([
 
         // syncIndex associations
         syncLocations = syncLocations || {};
-        var sync = _.reduce(syncLocations, function(sync, syncAttributes, syncIndex) {
-            return sync + syncIndex + ";";
+        var sync = _.reduce(syncLocations, function(sync, syncAttributes) {
+            return sync + syncAttributes.syncIndex + ";";
         }, ";");
 
         localStorage[fileIndex + ".title"] = title;
diff --git a/js/html/settingsTemplate.html b/js/html/settingsTemplate.html
deleted file mode 100644
index a2dc75b4..00000000
--- a/js/html/settingsTemplate.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-<%= documentTitle %>
-
-
-<%= documentHTML %>
-
-
\ No newline at end of file
diff --git a/js/publisher.js b/js/publisher.js
index 45270a38..c1daa72b 100644
--- a/js/publisher.js
+++ b/js/publisher.js
@@ -36,7 +36,11 @@ define([
                 // Store publishIndex
                 publishAttributes.publishIndex = publishIndex;
                 // Replace provider ID by provider module in attributes
-                publishAttributes.provider = providerMap[publishAttributes.provider];
+                var provider = providerMap[publishAttributes.provider];
+                if(!provider) {
+                    throw new Error("Invalid provider ID: " + publishAttributes.provider);
+                }
+                publishAttributes.provider = provider;
                 fileDesc.publishLocations[publishIndex] = publishAttributes;
             }
             catch(e) {
@@ -60,7 +64,7 @@ define([
                 publishAttributes: publishAttributes
             });
         }
-        catch (e) {
+        catch(e) {
             extensionMgr.onError(e);
             throw e;
         }
@@ -233,7 +237,7 @@ define([
         $(".action-download-template").click(function() {
             var content = publisher.applyTemplate();
             var title = fileMgr.getCurrentFile().title;
-            utils.saveAs(content, title + ".txt");
+            utils.saveAs(content, title + (settings.template.indexOf("documentHTML") === -1 ? ".md" : ".html"));
         });
     });
 
diff --git a/js/settings.js b/js/settings.js
index 8c7ee974..42582521 100644
--- a/js/settings.js
+++ b/js/settings.js
@@ -18,6 +18,9 @@ define([
             '\n',
+            '\n',
             '\n',
             '<%= documentHTML %>\n',
             '