diff --git a/Core.hs b/Core.hs
--- a/Core.hs
+++ b/Core.hs
@@ -57,8 +57,8 @@
 import System.IO                (hPutStrLn, hGetLine, stderr, hFlush)
 import System.IO.Unsafe         (unsafeInterleaveIO)
 import System.Process           (waitForProcess)
-import System.Random            (getStdRandom, randomR)
 import System.Time              (getClockTime)
+import System.Random.Mersenne
 
 import System.Posix.Process     (exitImmediately)
 import System.Posix.User        (getUserEntryForID, getRealUserID, homeDirectory)
@@ -345,7 +345,9 @@
 -- | Play a random song
 playRandom :: IO ()
 playRandom = modifySTM $ \st -> do
-    n <- getStdRandom (randomR (0, max 0 (size st -1)))
+    let g = randomGen st
+    n' <- random g :: IO Int
+    let n = abs n' `mod` (size st -1)
     playAtN st (const n)
 
 -- | Play the song before the current song, if we're not at the beginning
@@ -460,8 +462,8 @@
                                 Nothing     -> Nothing
                                 Just (r,d)  -> Just (r,d)
                 Just (s,d)  -> case compileM (P.pack s) [caseless] of
-                                Nothing     -> Nothing
-                                Just v      -> Just (v,d)
+                                Left _      -> Nothing
+                                Right v     -> Just (v,d)
         case mre of
             Nothing -> return (st,False)    -- no pattern
             Just (p,forwards) -> do
diff --git a/State.hs b/State.hs
--- a/State.hs
+++ b/State.hs
@@ -36,6 +36,7 @@
 import System.IO                (Handle)
 import Foreign.C.Types          (CFile)
 import Foreign.Ptr              (Ptr)
+import System.Random.Mersenne
 
 import Control.Concurrent       (ThreadId)
 import Control.Concurrent.MVar
@@ -80,6 +81,7 @@
        ,modified        :: !(MVar ())           -- Set when redrawable components of 
                                                 -- the state are modified. The ui
                                                 -- refresh thread waits on this.
+       ,randomGen       :: MTGen
     }
 
 ------------------------------------------------------------------------
@@ -119,6 +121,7 @@
        ,mode         = Normal
        ,minibuffer   = Fast P.empty defaultSty
        ,uptime       = P.empty
+       ,randomGen    = unsafePerformIO (newMTGen Nothing)
     }
 
 --
diff --git a/Tree.hs b/Tree.hs
--- a/Tree.hs
+++ b/Tree.hs
@@ -1,6 +1,6 @@
 {-# OPTIONS -fno-warn-orphans #-}
 -- 
--- Copyright (c) 2005 Don Stewart - http://www.cse.unsw.edu.au/~dons
+-- Copyright (c) 2005-8 Don Stewart - http://www.cse.unsw.edu.au/~dons
 -- 
 -- This program is free software; you can redistribute it and/or
 -- modify it under the terms of the GNU General Public License as
@@ -27,6 +27,8 @@
 import FastIO
 import Syntax           (Mode(..))
 import qualified Data.ByteString.Char8 as P
+import qualified Data.ByteString.Lazy  as L
+import Codec.Compression.GZip
 
 import Data.Binary
 
@@ -231,7 +233,8 @@
      }
 
 writeTree :: FilePath -> SerialT -> IO ()
-writeTree = encodeFile
+writeTree f s = L.writeFile f (compress (encode s))
 
 readTree :: FilePath -> IO SerialT
-readTree = decodeFile
+readTree f    = do s <- L.readFile f
+                   return (decode (decompress s))
diff --git a/hmp3.cabal b/hmp3.cabal
--- a/hmp3.cabal
+++ b/hmp3.cabal
@@ -1,29 +1,40 @@
 name:                hmp3
-version:             1.4
-homepage:            http://code.haskell.org/~dons/code/hmp3
+version:             1.5.1
+homepage:            http://www.cse.unsw.edu.au/~dons/hmp3.html
 license:             GPL
 license-file:        LICENSE
 author:              Don Stewart
 maintainer:          dons@galois.com
 category:            Sound
-synopsis:            An ncurses mp3 player written in Haskell 
-description: 
+synopsis:            An ncurses mp3 player written in Haskell
+description:
     An mp3 player with a curses frontend. Playlists are populated by
     passing directory names on the commandline, and saved to the
     ~/.hmp3db database. Type 'h' to display the help page.  Colours may
     be configured at runtime by editing the "~/.hmp3" file.
-    .
 cabal-version:      >= 1.2
+build-type:         Simple
 extra-source-files:  Keymap.hs-boot README TODO configure configure.ac
+                     cbits/config.h.in ./cbits/utils.h ./cbits/utils.c
 
+
 flag small_base
   description: Choose the new smaller, split-up base package.
 
 executable hmp3
-    build-depends:     unix, binary >= 0.4, pcre-light >=0.2.1
+    build-depends:     unix,
+                       zlib >= 0.4,
+                       binary >= 0.4,
+                       pcre-light >= 0.3,
+                       mersenne-random >= 0.1
     if flag(small_base)
-        build-depends: base >= 3, bytestring >= 0.9, containers,
-                       array, old-time, directory, process, random
+        build-depends: base >= 3,
+                       bytestring >= 0.9,
+                       containers,
+                       array,
+                       old-time,
+                       directory,
+                       process
     else
         build-depends: base < 3
 
