diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 6a30efbf5..70324d1af 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -120,7 +120,7 @@ pandocToLaTeX options (Pandoc meta blocks) = do
                               Right r -> r
                               Left _  -> ""
   case lookup "documentclass" (writerVariables options) `mplus`
-        parseMaybe (withObject "object" (.: "documentclass")) metadata of
+        fmap stringify (lookupMeta "documentclass" meta) of
          Just x  | x `elem` bookClasses -> modify $ \s -> s{stBook = True}
                  | otherwise            -> return ()
          Nothing | documentClass `elem` bookClasses