diff --git a/ChangeLog.md b/ChangeLog.md
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,7 +1,7 @@
 # Changelog for experimenter
 
-Release 0.1.0.6 on 15.03.2021:
-    - Using withMVar instead of modifyMVar_
+Release 0.1.0.8 on 15.03.2021:
+    - Using IORef instead of MVar due to deadlocks
 
 Release 0.1.0.3 on 31.12.2020:
     - Using username for LaTeX output
diff --git a/experimenter.cabal b/experimenter.cabal
--- a/experimenter.cabal
+++ b/experimenter.cabal
@@ -4,10 +4,10 @@
 --
 -- see: https://github.com/sol/hpack
 --
--- hash: 2b9823aaa76e5b2c3460c6368bb8bacca57bd553f4e26daa4181b268f1fcf1bb
+-- hash: 8de71882b65f310783aca9c07080c06611417b25a44cfef1855e8c28eb146e51
 
 name:           experimenter
-version:        0.1.0.6
+version:        0.1.0.8
 synopsis:       Perform scientific experiments stored in a DB, and generate reports.
 description:    Please see the README on GitHub at <https://github.com/schnecki/experimenter#readme>
 category:       Experiment
diff --git a/src/Experimenter/Run.hs b/src/Experimenter/Run.hs
--- a/src/Experimenter/Run.hs
+++ b/src/Experimenter/Run.hs
@@ -26,7 +26,6 @@
 
 import           Control.Arrow                (first, (&&&), (***))
 import           Control.Arrow                (second)
-import           Control.Concurrent.MVar
 import           Control.DeepSeq
 import           Control.Lens
 import           Control.Monad.IO.Class
@@ -749,18 +748,21 @@
   foldM' f acc' xs
 
 
-splitSizeMVar :: MVar Int
-splitSizeMVar = unsafePerformIO $ newMVar 2000
-{-# NOINLINE splitSizeMVar #-}
+splitSizeRef :: IORef Int
+splitSizeRef = unsafePerformIO $ newIORef 2000
+{-# NOINLINE splitSizeRef #-}
 
 increaseSplitSize :: IO ()
-increaseSplitSize = liftIO $ void $ withMVar splitSizeMVar (return . min 128000 . (*2))
+increaseSplitSize = liftIO $ void $ atomicModifyIORef' splitSizeRef ((\x -> (x, x)) . min 128000 . (*2))
+{-# NOINLINE increaseSplitSize #-}
 
 decreaseSplitSize :: IO ()
-decreaseSplitSize = liftIO $ void $ withMVar splitSizeMVar (return . max 500 . (`div` 2))
+decreaseSplitSize = liftIO $ void $ atomicModifyIORef' splitSizeRef ((\x -> (x, x)) . max 500 . (`div` 2))
+{-# NOINLINE decreaseSplitSize #-}
 
 getSplitSize :: IO Int
-getSplitSize = liftIO $ fromMaybe 5000 <$> tryReadMVar splitSizeMVar
+getSplitSize = liftIO $ atomicModifyIORef' splitSizeRef (\x -> (x, x))
+{-# NOINLINE getSplitSize #-}
 
 
 data RunData a =
@@ -827,10 +829,10 @@
       eTime' <- liftIO getCurrentTime
       let runTime = diffUTCTime (fromJust eTime) sTime
           saveTime = diffUTCTime eTime' sTime'
+      when printInfo $ $(logInfo) $ "Done and saved. Computation Time of " <> tshow (length periodsToRun) <> ": " <> tshow runTime <> ". Saving Time: " <> tshow saveTime
       when (isNothing maxSteps && nrOfPeriodsToRun == splitPeriods) $ liftIO $ do
         when (runTime < 60 * max 5 saveTime) increaseSplitSize
         when (runTime > 120 * max 5 saveTime) decreaseSplitSize
-      when printInfo $ $(logInfo) $ "Done and saved. Computation Time of " <> tshow (length periodsToRun) <> ": " <> tshow runTime <> ". Saving Time: " <> tshow saveTime
       if len - curLen - length periodsToRun > 0
         then return (False, True, force resData') -- runResultData expId maxSteps len repResType (force resData')
         else return $! (True, True, set endState mkEndStateAvailableOnDemand $ set startState mkStartStateAvailableOnDemand resData')
