diff --git a/admin/write-js.php b/admin/write-js.php
index e71a71c4..3fb5271e 100644
--- a/admin/write-js.php
+++ b/admin/write-js.php
@@ -131,7 +131,10 @@ $(document).ready(function() {
 
     function autoSaveListener () {
         setInterval(function () {
-            idInput.val(cid);
+            if (cid) {
+                idInput.val(cid);
+            }
+
             var data = form.serialize();
                 
             if (savedData != data && !locked) {