diff --git a/Changelog.md b/Changelog.md
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,5 +1,9 @@
 # Changelog
 
+## 0.4.0.1 (December 2022)
+
+- Fix [Unicode blocks handling on big-endian architectures](https://github.com/composewell/unicode-data/issues/97).
+
 ## 0.4.0 (September 2022)
 
 - Update to [Unicode 15.0.0](https://www.unicode.org/versions/Unicode15.0.0/).
diff --git a/exe/Parser/Text.hs b/exe/Parser/Text.hs
--- a/exe/Parser/Text.hs
+++ b/exe/Parser/Text.hs
@@ -318,6 +318,8 @@
         , "(Block(..), BlockDefinition(..), block, blockDefinition)"
         , "where"
         , ""
+        , "#include \"MachDeps.h\""
+        , ""
         , "import Data.Ix (Ix)"
         , "import GHC.Exts"
         , ""
@@ -381,9 +383,9 @@
         , "    getRawCodePoint# k# ="
         , "#ifdef WORDS_BIGENDIAN"
         , "#if MIN_VERSION_base(4,16,0)"
-        , "        byteSwap32# (word32ToWord# (indexWord32OffAddr# addr# k#))"
+        , "        narrow32Word# (byteSwap32# (word32ToWord# (indexWord32OffAddr# ranges# k#)))"
         , "#else"
-        , "        byteSwap32# (indexWord32OffAddr# ranges# k#)"
+        , "        narrow32Word# (byteSwap32# (indexWord32OffAddr# ranges# k#))"
         , "#endif"
         , "#elif MIN_VERSION_base(4,16,0)"
         , "        word32ToWord# (indexWord32OffAddr# ranges# k#)"
@@ -1279,9 +1281,9 @@
         , "    indexInt32OffAddr'# k# ="
         , "#ifdef WORDS_BIGENDIAN"
         , "#if MIN_VERSION_base(4,16,0)"
-        , "        word2Int# (byteSwap32# (word32ToWord# (indexWord32OffAddr# offsets# k#)))"
+        , "        word2Int# (narrow32Word# (byteSwap32# (word32ToWord# (indexWord32OffAddr# offsets# k#))))"
         , "#else"
-        , "        word2Int# (byteSwap32# (indexWord32OffAddr# offsets# k#))"
+        , "        word2Int# (narrow32Word# (byteSwap32# (indexWord32OffAddr# offsets# k#)))"
         , "#endif"
         , "#elif MIN_VERSION_base(4,16,0)"
         , "        int32ToInt# (indexInt32OffAddr# offsets# k#)"
diff --git a/lib/Unicode/Internal/Char/Blocks.hs b/lib/Unicode/Internal/Char/Blocks.hs
--- a/lib/Unicode/Internal/Char/Blocks.hs
+++ b/lib/Unicode/Internal/Char/Blocks.hs
@@ -13,6 +13,8 @@
 (Block(..), BlockDefinition(..), block, blockDefinition)
 where
 
+#include "MachDeps.h"
+
 import Data.Ix (Ix)
 import GHC.Exts
 
@@ -729,9 +731,9 @@
     getRawCodePoint# k# =
 #ifdef WORDS_BIGENDIAN
 #if MIN_VERSION_base(4,16,0)
-        byteSwap32# (word32ToWord# (indexWord32OffAddr# addr# k#))
+        narrow32Word# (byteSwap32# (word32ToWord# (indexWord32OffAddr# ranges# k#)))
 #else
-        byteSwap32# (indexWord32OffAddr# ranges# k#)
+        narrow32Word# (byteSwap32# (indexWord32OffAddr# ranges# k#))
 #endif
 #elif MIN_VERSION_base(4,16,0)
         word32ToWord# (indexWord32OffAddr# ranges# k#)
diff --git a/test/Main.hs b/test/Main.hs
--- a/test/Main.hs
+++ b/test/Main.hs
@@ -1,1 +1,10 @@
-{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
+module Main where
+
+import Test.Hspec
+import qualified Unicode.CharSpec
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = describe "Unicode.Char" Unicode.CharSpec.spec
diff --git a/unicode-data.cabal b/unicode-data.cabal
--- a/unicode-data.cabal
+++ b/unicode-data.cabal
@@ -1,6 +1,6 @@
 cabal-version:       2.2
 name:                unicode-data
-version:             0.4.0
+version:             0.4.0.1
 synopsis:            Access Unicode Character Database (UCD)
 description:
   @unicode-data@ provides Haskell APIs to efficiently access the
@@ -148,8 +148,6 @@
       base             >= 4.7   && < 4.18
     , hspec            >= 2.0   && < 2.11
     , unicode-data
-  build-tool-depends:
-      hspec-discover:hspec-discover >= 2.0 && < 2.11
   -- We need to match a GHC version with the same Unicode version.
   -- See: test/Unicode/CharSpec.hs for compatibility table.
   if impl(ghc >= 9.5.1)
