diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.4.0.1
+
+* Fix race condition
+
 ## 0.4.0.0
 
 * Fix race conditions
diff --git a/poolboy.cabal b/poolboy.cabal
--- a/poolboy.cabal
+++ b/poolboy.cabal
@@ -1,6 +1,6 @@
 cabal-version:       3.0
 name:                poolboy
-version:             0.4.0.0
+version:             0.4.0.1
 author:              Gautier DI FOLCO
 maintainer:          foss@difolco.dev
 category:            Data
diff --git a/src/Data/Poolboy.hs b/src/Data/Poolboy.hs
--- a/src/Data/Poolboy.hs
+++ b/src/Data/Poolboy.hs
@@ -39,7 +39,7 @@
 import Control.Monad
 import Data.Functor (($>))
 import qualified Data.HashMap.Strict as HM
-import Data.Maybe (isJust, listToMaybe)
+import Data.Maybe (fromMaybe, isJust, listToMaybe)
 import GHC.Conc (labelThread)
 import GHC.Stack (HasCallStack, callStack, getCallStack, prettySrcLoc, withFrozenCallStack)
 import UnliftIO (MonadIO (liftIO), MonadUnliftIO)
@@ -272,12 +272,12 @@
 enqueueTrackingAfterUnsafe :: forall a m i. (MonadUnliftIO m) => WorkQueue m -> m i -> m a -> m (Async a)
 enqueueTrackingAfterUnsafe wq prerequisite f = do
   wq.onCommand Enqueue
-  let register threadId taskM = atomicModifyIORef wq.inflightWorkers (\ws -> (HM.insert threadId taskM ws, ()))
+  let register f' = atomicModifyIORef wq.inflightWorkers (\ws -> (f' ws, ()))
   task <-
     async' wq $ do
       wq.onCommand SpawnTask
       threadId <- myThreadId
-      register threadId Nothing
+      register $ HM.alter (Just . fromMaybe Nothing) threadId
       void prerequisite
       bracket_
         ( wq.onCommand WaitAvailableWorker
@@ -290,7 +290,7 @@
         )
         f
   wq.onCommand $ flip EnqueueRegisterTask (asyncThreadId task)
-  register (asyncThreadId task) (Just $ task $> ())
+  register $ HM.insert (asyncThreadId task) (Just $ task $> ())
   return task
 
 -- | Start and label a thread
