diff --git a/easytensor.cabal b/easytensor.cabal
--- a/easytensor.cabal
+++ b/easytensor.cabal
@@ -1,5 +1,5 @@
 name: easytensor
-version: 1.0.0.0
+version: 1.0.0.1
 cabal-version: >=1.22
 build-type: Simple
 license: BSD3
diff --git a/src/Numeric/DataFrame/IO.hs b/src/Numeric/DataFrame/IO.hs
--- a/src/Numeric/DataFrame/IO.hs
+++ b/src/Numeric/DataFrame/IO.hs
@@ -193,10 +193,10 @@
 withDataFramePtr df k = case dimKind @k of
     DimNat -> case df of
       IODataFrame x
-        -> IO $ withDataFramePtr# x (unsafeCoerce# k)
+        -> IO $ withDataFramePtr# x (\p -> case k (Ptr p) of IO f -> f)
     DimXNat -> case df of
       XIOFrame (IODataFrame x)
-        -> IO $ withDataFramePtr# x (unsafeCoerce# k)
+        -> IO $ withDataFramePtr# x (\p -> case k (Ptr p) of IO f -> f)
 
 
 -- | Check if the byte array wrapped by this DataFrame is pinned,
