diff --git a/Language/LaTeX.hs b/Language/LaTeX.hs
--- a/Language/LaTeX.hs
+++ b/Language/LaTeX.hs
@@ -77,8 +77,8 @@
 import System.FilePath
 import System.Directory (createDirectoryIfMissing)
 import System.Exit
-import qualified System.IO.UTF8 as U
--- import Codec.Binary.UTF8.String (encodeString)
+import System.IO (withBinaryFile, IOMode(WriteMode), hPutStr)
+import Codec.Binary.UTF8.String (encode)
 
 data ViewOpts = ViewOpts { basedir   :: FilePath
                          , pdflatex  :: String
@@ -95,19 +95,15 @@
 
 testViewOpts = myViewOpts { basedir = "tests" }
 
-{-
--- | The computation 'writeBinaryFile' @file str@ function writes the string @str@,
--- to the file @file@.
-writeBinaryFile :: FilePath -> String -> IO ()
-writeBinaryFile f txt = withBinaryFile f WriteMode (\ hdl -> hPutStr hdl txt)
--}
+writeFileUTF8 :: FilePath -> String -> IO ()
+writeFileUTF8 n s = withBinaryFile n WriteMode (\hdl -> hPutStr hdl txt)
+   where txt = map (toEnum . fromEnum) (encode s)
 
 quickView :: ViewOpts -> FilePath -> LatexM Document -> IO ()
 quickView vo basename doc =
      do createDirectoryIfMissing False (basedir vo)
         when (showoutput vo) $ putStrLn s
-        -- writeBinaryFile (basedir vo </> tex) s
-        U.writeFile (basedir vo </> tex) s
+        writeFileUTF8 (basedir vo </> tex) s
         exitWith =<< system cmd
   -- where s = encodeString . either error id $ showLaTeX doc
   where s = either error id $ showLaTeX doc
diff --git a/Language/LaTeX/Builder/Internal.hs b/Language/LaTeX/Builder/Internal.hs
--- a/Language/LaTeX/Builder/Internal.hs
+++ b/Language/LaTeX/Builder/Internal.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE FlexibleContexts #-}
 module Language.LaTeX.Builder.Internal where
 
 import Prelude hiding (sqrt, min, max, lcm, gcd, log, mod, tanh, cosh, tan, sinh,
diff --git a/Language/LaTeX/Types.hs b/Language/LaTeX/Types.hs
--- a/Language/LaTeX/Types.hs
+++ b/Language/LaTeX/Types.hs
@@ -429,7 +429,7 @@
 type ErrorMessage = String
 
 newtype LatexM a = LatexM { runLatexM :: Either ErrorMessage a }
-  deriving (Functor, Applicative, Monad, MonadPlus,
+  deriving (Functor, Applicative, Alternative, Monad, MonadPlus,
             MonadError ErrorMessage, Show, Eq, Num, Fractional,
             Typeable, Data)
 
diff --git a/hlatex.cabal b/hlatex.cabal
--- a/hlatex.cabal
+++ b/hlatex.cabal
@@ -1,6 +1,6 @@
 name:            hlatex
 cabal-version:   >= 1.8
-version:         0.3
+version:         0.3.1
 license:         BSD3
 license-File:    LICENSE
 copyright:       (c) Nicolas Pouillard
