diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php
index 967228946c4fcbb89b9b46ba7648fb67f5971dbf..429d6794bb0fd553b12f9399c8d40f9887592fb2 100644
--- a/include/staff/ticket-view.inc.php
+++ b/include/staff/ticket-view.inc.php
@@ -471,7 +471,7 @@ $tcount = $ticket->getThreadEntries($types)->count();
         data-lock-object-id="ticket/<?php echo $ticket->getId(); ?>"
         data-lock-id="<?php echo $mylock ? $mylock->getId() : ''; ?>"
         action="tickets.php?id=<?php
-        echo $ticket->getId(); ?>" name="reply" method="post" enctype="multipart/form-data">
+        echo $ticket->getId(); ?>#reply" name="reply" method="post" enctype="multipart/form-data">
         <?php csrf_token(); ?>
         <input type="hidden" name="id" value="<?php echo $ticket->getId(); ?>">
         <input type="hidden" name="msgId" value="<?php echo $msgId; ?>">
diff --git a/scp/js/scp.js b/scp/js/scp.js
index 32c18ca7c19fc887daaa3cfdd362f1f73c931660..1b9327b5275dd08e595080f53cc4ca0caf76c08d 100644
--- a/scp/js/scp.js
+++ b/scp/js/scp.js
@@ -956,7 +956,8 @@ $.changeHash = function(hash, quiet) {
 
 // Forms — submit, stay on same tab
 $(document).on('submit', 'form', function() {
-    $(this).attr('action', $(this).attr('action') + window.location.hash);
+    if ($(this).attr('action').indexOf('#') == -1)
+        $(this).attr('action', $(this).attr('action') + window.location.hash);
 });
 
 //Collaborators
diff --git a/scp/js/thread.js b/scp/js/thread.js
index b4bd2a4350ad751760794a0a4f17cc117d4aab74..0b4ebe50213763d035bd4df033856d6c51fe2241 100644
--- a/scp/js/thread.js
+++ b/scp/js/thread.js
@@ -165,7 +165,7 @@ var thread = {
 
         // Open first response option tab if not already active
         if (!document.location.hash)
-            $('.actions .tabs li:visible:first:not(.active) a', $container).trigger('click');
+            $('.actions .tabs li:visible:first:not(.active) a', $container.parent()).trigger('click');
     }
 };