diff --git a/hstatistics.cabal b/hstatistics.cabal
--- a/hstatistics.cabal
+++ b/hstatistics.cabal
@@ -1,8 +1,8 @@
 Name:               hstatistics
-Version:            0.2.2.6
+Version:            0.2.2.7
 License:            BSD3
 License-file:       LICENSE
-Copyright:          (c) A.V.H. McPhail 2010
+Copyright:          (c) A.V.H. McPhail 2010, 2011
 Author:             Vivian McPhail
 Maintainer:         haskell.vivian.mcphail <at> gmail <dot> com
 Stability:          provisional
@@ -17,9 +17,9 @@
      .
      Feature requests, suggestions, and bug fixes welcome.
 Category:           Math, Statistics
-tested-with:        GHC ==6.12.1
+tested-with:        GHC ==7.0.1
 
-cabal-version:      >=1.6
+cabal-version:      >=1.8
 
 build-type:         Simple
 
@@ -31,7 +31,7 @@
     Build-Depends:      base >= 4 && < 5,
                         array, random,
                         hmatrix >= 0.10.0.0,
-                        hmatrix-gsl-stats >= 0.1.2.6
+                        hmatrix-gsl-stats >= 0.1.2.9
 
     Extensions:         
 
diff --git a/lib/Numeric/Statistics.hs b/lib/Numeric/Statistics.hs
--- a/lib/Numeric/Statistics.hs
+++ b/lib/Numeric/Statistics.hs
@@ -1,4 +1,4 @@
-{-# OPTIONS_GHC -fglasgow-exts #-}
+{-# LANGUAGE FlexibleContexts #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Numeric.Statistics
diff --git a/lib/Numeric/Statistics/Histogram.hs b/lib/Numeric/Statistics/Histogram.hs
--- a/lib/Numeric/Statistics/Histogram.hs
+++ b/lib/Numeric/Statistics/Histogram.hs
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -fglasgow-exts #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Numeric.Statistics.Histogram
diff --git a/lib/Numeric/Statistics/ICA.hs b/lib/Numeric/Statistics/ICA.hs
--- a/lib/Numeric/Statistics/ICA.hs
+++ b/lib/Numeric/Statistics/ICA.hs
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -fglasgow-exts #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Numeric.Statistics.ICA
@@ -116,8 +115,8 @@
 
 -----------------------------------------------------------------------------
 
-unconcat 0     _ _  = []
-unconcat (r+1) c xs = [take c xs] ++ unconcat r c (drop c xs)
+unconcat 0 _ _  = []
+unconcat r c xs = [take c xs] ++ unconcat (r-1) c (drop c xs)
 
 random_vector :: Int -> (Int,Int) -> Matrix Double
 random_vector s (r,c) = fromLists $ unconcat r c $ randomRs (-1,1) (mkStdGen s)
diff --git a/lib/Numeric/Statistics/Information.hs b/lib/Numeric/Statistics/Information.hs
--- a/lib/Numeric/Statistics/Information.hs
+++ b/lib/Numeric/Statistics/Information.hs
@@ -1,4 +1,4 @@
-{-# OPTIONS_GHC -fglasgow-exts #-}
+{-# LANGUAGE FlexibleContexts #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Numeric.Statistics.Information
diff --git a/lib/Numeric/Statistics/PCA.hs b/lib/Numeric/Statistics/PCA.hs
--- a/lib/Numeric/Statistics/PCA.hs
+++ b/lib/Numeric/Statistics/PCA.hs
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -fglasgow-exts #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Numeric.Statistics.PCA
diff --git a/lib/Numeric/Statistics/PDF.hs b/lib/Numeric/Statistics/PDF.hs
--- a/lib/Numeric/Statistics/PDF.hs
+++ b/lib/Numeric/Statistics/PDF.hs
@@ -1,4 +1,5 @@
-{-# OPTIONS_GHC -fglasgow-exts #-}
+{-# LANGUAGE MultiParamTypeClasses,
+             FlexibleInstances #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Numeric.Statistics.PDF
diff --git a/lib/Numeric/Statistics/Surrogate.hs b/lib/Numeric/Statistics/Surrogate.hs
--- a/lib/Numeric/Statistics/Surrogate.hs
+++ b/lib/Numeric/Statistics/Surrogate.hs
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -fglasgow-exts #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Numeric.Statistics.Surrogate
@@ -41,15 +40,15 @@
 surrogate r n f d = I.listArray (1,n+1) $ (f d) : (surrogate' (mkStdGen r) n f d)
 
 surrogate' :: StdGen -> Int-> (I.Array Int (Vector Double) -> a) -> I.Array Int (Vector Double) -> [a]
-surrogate' _ 0     _ _ = []
-surrogate' g (n+1) f d = let (g',g'') = split g
-                             d' = permute_data g' d
-                         in (f d) : (surrogate' g'' n f d)
+surrogate' _ 0 _ _ = []
+surrogate' g n f d = let (g',g'') = split g
+                         d' = permute_data g' d
+                     in (f d) : (surrogate' g'' (n-1) f d)
 
 randomList :: StdGen -> Int -> [Int]
-randomList _ 0     = []
-randomList g (n+1) = let (r,g') = random g
-                     in r : (randomList g' n)
+randomList _ 0 = []
+randomList g n = let (r,g') = random g
+                 in r : (randomList g' (n-1))
 
 permute_data :: StdGen -> I.Array Int (Vector Double) -> I.Array Int (Vector Double)
 permute_data g d = let s = I.rangeSize $ I.bounds d
