diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Revision history for ghc-debug-stub
 
+## 0.2.1.0 -- 2022-05-06
+
+* Fix bug with write_block on BF_COMPACT closures
+
 ## 0.2.0.0 -- 2021-12-06
 
 * Second version
diff --git a/cbits/stub.cpp b/cbits/stub.cpp
--- a/cbits/stub.cpp
+++ b/cbits/stub.cpp
@@ -322,11 +322,31 @@
 
 
 static void write_block(Response * resp, bdescr * bd){
-  resp->write(bd->flags);
-  resp->write(bd->start);
-  uint32_t len_payload = htonl(BLOCK_SIZE * bd->blocks);
+  bdescr * real_bd;
+  // TODO, need a special case here as well for LARGE objects?
+  if (bd->flags & BF_COMPACT){
+    bdescr *object_block, *head_block;
+
+    object_block = bd;
+
+    ASSERT((object_block->flags & BF_COMPACT) != 0);
+
+    if (object_block->blocks == 0)
+        head_block = object_block->link;
+    else
+        head_block = object_block;
+
+    ASSERT((head_block->flags & BF_COMPACT) != 0);
+
+    real_bd = head_block;
+  } else {
+    real_bd = bd;
+  }
+  resp->write(real_bd->flags);
+  resp->write(real_bd->start);
+  uint32_t len_payload = htonl(BLOCK_SIZE * real_bd->blocks);
   resp->write(len_payload);
-  resp->write((const char *) bd->start, BLOCK_SIZE * bd->blocks);
+  resp->write((const char *) real_bd->start, BLOCK_SIZE * real_bd->blocks);
 }
 
 static void write_blocks(Response * resp, bdescr * bd){
@@ -589,7 +609,6 @@
       }
       case CMD_BLOCKS:
         {
-        printf("BD");
         listAllBlocks(list_blocks_callback, (void *) &resp);
         resp.finish(RESP_OKAY);
         break;
diff --git a/ghc-debug-stub.cabal b/ghc-debug-stub.cabal
--- a/ghc-debug-stub.cabal
+++ b/ghc-debug-stub.cabal
@@ -1,6 +1,6 @@
 cabal-version:       2.4
 name:                ghc-debug-stub
-version:             0.2.0.0
+version:             0.2.1.0
 synopsis:            Functions for instrumenting your application so the heap
                      can be analysed with ghc-debug-common.
 description:         Functions for instrumenting your application so the heap can
@@ -23,11 +23,11 @@
 library
   exposed-modules:     GHC.Debug.Stub
   hs-source-dirs:      src
-  build-depends:       base >=4.12 && <4.14
+  build-depends:       base >=4.16 && < 5
                      , directory ^>= 1.3
                      , filepath ^>= 1.4
                      , ghc-prim ^>= 0.8
-                     , ghc-debug-convention ^>= 0.2
+                     , ghc-debug-convention == 0.2.0.0
   default-language:    Haskell2010
   cxx-sources:         cbits/stub.cpp, cbits/socket.cpp, cbits/trace.cpp
   cxx-options:         -std=gnu++11 -O3 -g3 -DTHREADED_RTS
