Bug fixes for dialog boxes
diff --git a/js/options.js b/js/options.js
index 8a7e6cb..e1ffdfb 100644
--- a/js/options.js
+++ b/js/options.js
@@ -83,7 +83,7 @@
         });
 
         // Handling The Dialog
-        $("#languages_add").addEventListener('click', function() { $("dialog#languages_add_dialog").showModal(); });
+        $("#languages_add").addEventListener('click', function() { $("dialog#languages_add_dialog").showModal(); $("#select_language").focus(); });
         $("#languages_add_cancel").addEventListener('click', function() { $("dialog#languages_add_dialog").close(); });
         $("#languages_add_ok").addEventListener('click', function() {
             var el = document.createElement('li');
@@ -129,12 +129,15 @@
                 window.onhashchange = function() {
                     if (location.hash == "#credits") {
                         $("dialog#credits_dialog").showModal();
+                        $("#credits_ok").focus();
                     }
                 }
                 if (location.hash == "#credits") {
                     $("dialog#credits_dialog").showModal();
+                    $("#credits_ok").focus();
                 }
-                $("#credits_ok").addEventListener('click', function() { $("dialog#credits_dialog").close(); history.pushState("", document.title, window.location.pathname + window.location.search); });
+                $("#credits_ok").addEventListener('click', function() { $("dialog#credits_dialog").close(); });
+                $("dialog#credits_dialog").addEventListener('close', function() { history.pushState("", document.title, window.location.pathname + window.location.search); });
             }
         }
         xhr.open("GET", "json/credits.json", true);