diff --git a/app/App/Commands/CreateIndex.hs b/app/App/Commands/CreateIndex.hs
--- a/app/App/Commands/CreateIndex.hs
+++ b/app/App/Commands/CreateIndex.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE OverloadedStrings   #-}
 {-# LANGUAGE ScopedTypeVariables #-}
 
 module App.Commands.CreateIndex
@@ -43,12 +44,16 @@
     "standard" -> do
       IO.withFile filePath IO.ReadMode $ \hIn -> do
         contents <- LBS.resegmentPadded 512 <$> LBS.hGetContents hIn
-        let chunks = makeStandardJsonIbBpsUnsafe contents
-        IO.withFile outputIbFile IO.WriteMode $ \hIb -> do
-          IO.withFile outputBpFile IO.WriteMode $ \hBp -> do
-            forM_ chunks $ \(ibBs, bpBs) -> do
-              BS.hPut hIb ibBs
-              BS.hPut hBp bpBs
+        case makeStandardJsonIbBps contents of
+          Right chunks -> do
+            IO.withFile outputIbFile IO.WriteMode $ \hIb -> do
+              IO.withFile outputBpFile IO.WriteMode $ \hBp -> do
+                forM_ chunks $ \(ibBs, bpBs) -> do
+                  BS.hPut hIb ibBs
+                  BS.hPut hBp bpBs
+          Left msg -> do
+            IO.hPutStrLn IO.stderr $ "Unable to create index: " <> show msg
+            IO.exitFailure
     _ -> do
       IO.hPutStrLn IO.stderr $ "Unrecognised method: " <> show method
       IO.exitFailure
diff --git a/hw-json-simd.cabal b/hw-json-simd.cabal
--- a/hw-json-simd.cabal
+++ b/hw-json-simd.cabal
@@ -1,7 +1,7 @@
 cabal-version:  2.2
 
 name:           hw-json-simd
-version:        0.1.0.0
+version:        0.1.0.1
 synopsis:       SIMD-based JSON semi-indexer
 description:    Please see the README on GitHub at <https://github.com/haskell-works/hw-json-simd#readme>
 category:       Data
@@ -13,7 +13,7 @@
 license:        BSD-3-Clause
 license-file:   LICENSE
 build-type:     Simple
-tested-with:    GHC == 8.6.1, GHC == 8.4.3, GHC == 8.2.2
+tested-with:    GHC == 8.6.1, GHC == 8.4.3, GHC == 8.2.2, GHC == 7.10.3, GHC == 8.0.2
 extra-source-files:
     cbits/debug.h
     cbits/simd.h
@@ -51,15 +51,36 @@
 common optparse-applicative   { build-depends: optparse-applicative >= 0.14       && < 0.15   }
 common vector                 { build-depends: vector               >= 0.12       && < 0.13   }
 
-common semigroups     { if (!impl(ghc >=8.0.1)) { build-depends: { semigroups   >= 0.8.4  && < 0.19 } } }
-common transformers   { if (!impl(ghc >=8.0.1)) { build-depends: { transformers >= 0.4    && < 0.6  } } }
+common semigroups     { if (!impl(ghc >= 8.0.1))  { build-depends: { semigroups   >= 0.8.4  && < 0.19 } } }
+common transformers   { if (!impl(ghc >= 8.0.1))  { build-depends: { transformers >= 0.4    && < 0.6  } } }
 
+common config
+  ghc-options: -Wall
+  default-language: Haskell2010
+  if impl(ghc >= 8.0.1)
+    ghc-options: -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints
+  if flag(sse42)
+    ghc-options: -msse4.2
+    cc-options: -msse4.2
+  if flag(bmi2)
+    cc-options: -mbmi2
+    if impl(ghc >= 8.4.1)
+      ghc-options: -mbmi2
+  if flag(avx2)
+    cc-options: -mavx2
+
 library
-  import:   base
+  import:   base, config
           , bytestring
           , hw-prim
           , lens
           , vector
+  autogen-modules:  Paths_hw_json_simd
+  other-modules:    Paths_hw_json_simd
+  hs-source-dirs:   src
+  cc-options:       -mssse3 -mlzcnt -mbmi2 -mavx2
+  include-dirs:     cbits
+  build-tools:      c2hs
   exposed-modules:
       HaskellWorks.Data.Json.Simd.Capabilities
       HaskellWorks.Data.Json.Simd.Index.Simple
@@ -68,14 +89,6 @@
       HaskellWorks.Data.Json.Simd.Internal.Index.Simple
       HaskellWorks.Data.Json.Simd.Internal.Index.Standard
       HaskellWorks.Data.Json.Simd.Internal.List
-  autogen-modules:  Paths_hw_json_simd
-  other-modules:    Paths_hw_json_simd
-  hs-source-dirs:
-      src
-  ghc-options: -Wall
-  cc-options: -mssse3 -mlzcnt -mbmi2 -mavx2
-  include-dirs:
-      cbits
   c-sources:
       cbits/debug.c
       cbits/simd.c
@@ -83,33 +96,20 @@
       cbits/simd-state.c
       cbits/simd-phi-table-32.c
       cbits/simd-transition-table-32.c
-  build-tools:
-      c2hs
-  if flag(sse42)
-    ghc-options: -msse4.2
-    cc-options: -msse4.2
-  if flag(bmi2)
-    cc-options: -mbmi2
-  if (flag(bmi2)) && (impl(ghc >=8.4.1))
-    ghc-options: -mbmi2 -msse4.2
-  if flag(avx2)
-    cc-options: -mavx2
-  if (flag(avx2)) && (impl(ghc >=8.4.1))
-    ghc-options: -mbmi2 -msse4.2
-  if (impl(ghc >=8.0.1))
-    ghc-options: -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints
-  default-language: Haskell2010
-
+  
 executable hw-json-simd
-  import:   base
+  import:   base, config
           , bytestring
           , hw-prim
           , lens
           , optparse-applicative
           , semigroups
           , vector
-  main-is: Main.hs
+  main-is:          Main.hs
   autogen-modules:  Paths_hw_json_simd
+  hs-source-dirs:   app
+  build-depends:    hw-json-simd
+  ghc-options:      -threaded -rtsopts -with-rtsopts=-N
   other-modules:
       App.Commands
       App.Commands.Capabilities
@@ -117,52 +117,19 @@
       App.Commands.Types
       App.Lens
       Paths_hw_json_simd
-  hs-source-dirs:   app
-  ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
-  build-depends: hw-json-simd
-  if flag(sse42)
-    ghc-options: -msse4.2
-    cc-options: -msse4.2
-  if flag(bmi2)
-    cc-options: -mbmi2
-  if (flag(bmi2)) && (impl(ghc >=8.4.1))
-    ghc-options: -mbmi2 -msse4.2
-  if flag(avx2)
-    cc-options: -mavx2
-  if (flag(avx2)) && (impl(ghc >=8.4.1))
-    ghc-options: -mbmi2 -msse4.2
-  if (impl(ghc >=8.0.1))
-    ghc-options: -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints
-  default-language: Haskell2010
 
 test-suite hw-json-simd-test
-  import:   base
+  import:   base, config
           , bytestring
           , hw-prim
           , lens
+          , semigroups
+          , transformers
           , vector
-  type: exitcode-stdio-1.0
-  main-is: Spec.hs
+  type:             exitcode-stdio-1.0
+  main-is:          Spec.hs
   autogen-modules:  Paths_hw_json_simd
   other-modules:    Paths_hw_json_simd
   hs-source-dirs:   test
-  ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
-  build-depends: hw-json-simd
-  if flag(sse42)
-    ghc-options: -msse4.2
-    cc-options: -msse4.2
-  if flag(bmi2)
-    cc-options: -mbmi2
-  if (flag(bmi2)) && (impl(ghc >=8.4.1))
-    ghc-options: -mbmi2 -msse4.2
-  if flag(avx2)
-    cc-options: -mavx2
-  if (flag(avx2)) && (impl(ghc >=8.4.1))
-    ghc-options: -mbmi2 -msse4.2
-  if (impl(ghc >=8.0.1))
-    ghc-options: -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints
-  if (!impl(ghc >=8.0.1))
-    build-depends:
-        semigroups >=0.8.4 && <0.19
-      , transformers >=0.4 && <0.6
-  default-language: Haskell2010
+  ghc-options:      -threaded -rtsopts -with-rtsopts=-N
+  build-depends:    hw-json-simd
diff --git a/src/HaskellWorks/Data/Json/Simd/Internal/Foreign.chs b/src/HaskellWorks/Data/Json/Simd/Internal/Foreign.chs
--- a/src/HaskellWorks/Data/Json/Simd/Internal/Foreign.chs
+++ b/src/HaskellWorks/Data/Json/Simd/Internal/Foreign.chs
@@ -4,7 +4,6 @@
 module HaskellWorks.Data.Json.Simd.Internal.Foreign where
 
 import Foreign
-import System.IO.Unsafe
 
 #include "../cbits/simd.h"
 
