diff --git a/modules/admin.py b/modules/admin.py
index 942cced8c36c007aa8963e2b2cd26df420641299..ba43e2743bc1c0bbe6d17504c82a0b89e7255436 100644
--- a/modules/admin.py
+++ b/modules/admin.py
@@ -325,8 +325,8 @@ def statement_delete():
 @admin_permission.require()
 def statement_undo():
     topic_id = request.args.get("topic_id", None)
-    if statement_id is not None:
-        statement = Statement.query.filter_by(executed=True).order_by(db.desc(Statement.execution_time)).first()
+    if topic_id is not None:
+        statement = Statement.query.filter_by(executed=True, topic_id=topic_id).order_by(db.desc(Statement.execution_time)).first()
         statement.undo()
         db.session.commit()
     return redirect(url_for(".topic_show", id=topic_id))
diff --git a/templates/admin_topic_show.html b/templates/admin_topic_show.html
index 429c7e025a929c52953b8fae9d08db96ed011139..0bf7acc054e2acec2eb8c1511391a2dad6bd55b9 100644
--- a/templates/admin_topic_show.html
+++ b/templates/admin_topic_show.html
@@ -59,7 +59,7 @@
                     <a href="{{ url_for(".statement_done", id=topic.sorted_statements()[0].id, topic_id=topic.id) }}" class="rede-href"><i class="material-icons" role="presentation">redo</i> Next</a>
                 </li>
                 {% endif %}
-                <li><a href="{{ url_for(".statement_undo") }}" class="rede-href"><i class="material-icons" role="presentation">undo</i> Previous</a></li>
+                <li><a href="{{ url_for(".statement_undo", topic_id=topic.id) }}" class="rede-href"><i class="material-icons" role="presentation">undo</i> Previous</a></li>
                 <li><a href="{{ url_for(".topic_show", id=topic.get_next_index()) }}"><i class="material-icons">arrow_forward</i> Next Topic</a></li>
                 <li><a href="{{ url_for(".topic_show", id=topic.get_previous_index()) }}"><i class="material-icons">arrow_backward</i>Previous Topic</a></li>
                 <li>