diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 6155aec59..438b04bc7 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -501,8 +501,8 @@ blockToLaTeX (Div (identifier,"slide":dclasses,dkvs)
       hasCodeBlock _               = []
   let hasCode (Code _ _) = [True]
       hasCode _          = []
-  let classes = dclasses ++ hclasses
-  let kvs = dkvs ++ hkvs
+  let classes = ordNub $ dclasses ++ hclasses
+  let kvs = ordNub $ dkvs ++ hkvs
   let fragile = "fragile" `elem` classes ||
                 not (null $ query hasCodeBlock bs ++ query hasCode bs)
   let frameoptions = ["allowdisplaybreaks", "allowframebreaks", "fragile",
diff --git a/test/command/6107.md b/test/command/6107.md
new file mode 100644
index 000000000..8444172ab
--- /dev/null
+++ b/test/command/6107.md
@@ -0,0 +1,27 @@
+```
+% pandoc -t beamer
+---
+title: A silly slide
+subtitle: Look for the sequel!
+---
+
+# A circus!
+
+## Another silly title
+
+Not much to do about nothing.
+
+## Epilogue {.standout}
+^D
+\hypertarget{a-circus}{%
+\section{A circus!}\label{a-circus}}
+
+\begin{frame}{Another silly title}
+\protect\hypertarget{another-silly-title}{}
+Not much to do about nothing.
+\end{frame}
+
+\begin{frame}[standout]{Epilogue}
+\protect\hypertarget{epilogue}{}
+\end{frame}
+```