diff --git a/nhentai/utils.py b/nhentai/utils.py
index 00e6b00..98a239a 100644
--- a/nhentai/utils.py
+++ b/nhentai/utils.py
@@ -100,7 +100,11 @@ def generate_main_html(output_dir='.'):
                 </div>\n\
             </div>\n'
     
-    os.chdir(output_dir) # switch to given dir
+    if output_dir == '':
+        os.chdir('.')
+    else:
+        os.chdir(output_dir) 
+    # switch to given dir
     doujinshi_dirs = next(os.walk('.'))[1] 
     # https://stackoverflow.com/questions/141291/how-to-list-only-top-level-directories-in-python
 
diff --git a/nhentai/viewer/scripts.js b/nhentai/viewer/scripts.js
index cb49af5..8e3f8bf 100644
--- a/nhentai/viewer/scripts.js
+++ b/nhentai/viewer/scripts.js
@@ -50,6 +50,7 @@ document.onkeypress = event => {
         case 'a':
             changePage(currentPage - 1);
             break;
+        // Return to previous page
         case 'q':
             window.history.go(-1);
             break;