diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown
--- a/CHANGELOG.markdown
+++ b/CHANGELOG.markdown
@@ -1,4 +1,7 @@
+0.2.1.0
+-------
+* Update to work with hmatrix 0.16
+
 0.2.0.0
 -------
 * Add partial output API
-
diff --git a/Data/NetCDF/HMatrix.hs b/Data/NetCDF/HMatrix.hs
--- a/Data/NetCDF/HMatrix.hs
+++ b/Data/NetCDF/HMatrix.hs
@@ -25,16 +25,20 @@
 
 instance NcStore HRowMajorMatrix where
   toForeignPtr (HRowMajorMatrix m) = fst $ unsafeMatrixToForeignPtr m
-  fromForeignPtr p s = HRowMajorMatrix $
-                       matrixFromVector RowMajor (last s) $
-                       unsafeFromForeignPtr p 0 (Prelude.product s)
+  fromForeignPtr p s =
+    let c = last s
+        d = product s
+    in HRowMajorMatrix $ matrixFromVector RowMajor (d `div` c) (last s) $
+       unsafeFromForeignPtr p 0 (Prelude.product s)
   smap f (HRowMajorMatrix m) = HRowMajorMatrix $ C.mapMatrix f m
 
 newtype HColumnMajorMatrix a = HColumnMajorMatrix (C.Matrix a)
 
 instance NcStore HColumnMajorMatrix where
   toForeignPtr (HColumnMajorMatrix m) = fst $ unsafeMatrixToForeignPtr m
-  fromForeignPtr p s = HColumnMajorMatrix $
-                       matrixFromVector ColumnMajor (last s) $
-                       unsafeFromForeignPtr p 0 (Prelude.product s)
+  fromForeignPtr p s =
+    let c = last s
+        d = product s
+    in HColumnMajorMatrix $ matrixFromVector ColumnMajor (d `div` c) (last s) $
+       unsafeFromForeignPtr p 0 (Prelude.product s)
   smap f (HColumnMajorMatrix m) = HColumnMajorMatrix $ C.mapMatrix f m
diff --git a/hnetcdf.cabal b/hnetcdf.cabal
--- a/hnetcdf.cabal
+++ b/hnetcdf.cabal
@@ -1,5 +1,5 @@
 name:                hnetcdf
-version:             0.2.0.0
+version:             0.2.1.0
 synopsis:            Haskell NetCDF library
 description:
   Bindings to the Unidata NetCDF library, along with a higher-level
@@ -39,10 +39,10 @@
 --                       Data.NetCDF.Raw.NetCDF4
   build-depends:       base                        >= 4.3      && < 5,
                        containers                  >= 0.4      && < 0.6,
-                       either                      >= 3.4.1    && < 3.5,
+                       either                      >= 3.4.1    && < 5,
                        errors                      >= 1.4.2    && < 1.5,
                        filepath                    >= 1.3      && < 1.4,
-                       hmatrix                     >= 0.15.2.0 && < 0.16,
+                       hmatrix                     >= 0.15.2.0 && < 0.17,
                        repa,
                        transformers                >= 0.2      && < 0.5,
                        vector                      >= 0.9      && < 0.11
@@ -108,7 +108,7 @@
                        base                        >= 4.3      && < 5,
                        containers                  >= 0.4      && < 0.6,
                        errors                      >= 1.4.2    && < 1.5,
-                       hmatrix                     >= 0.15.2.0 && < 0.16,
+                       hmatrix                     >= 0.15.2.0 && < 0.17,
                        repa,
                        vector                      >= 0.9      && < 0.11,
                        directory                   >= 1.1      && < 1.3,
