diff --git a/NationStates/RateLimit.hs b/NationStates/RateLimit.hs
--- a/NationStates/RateLimit.hs
+++ b/NationStates/RateLimit.hs
@@ -38,13 +38,13 @@
 -- | Run the given action, pausing as necessary to keep under the rate limit.
 rateLimit :: RateLimit -> IO a -> IO a
 rateLimit RateLimit { rateLock = lock, rateDelay = delay } action =
-    bracketOnError
-        (takeMVar lock)
-        (tryPutMVar lock)
-        (\prev -> do
-            now <- getTime Monotonic
-            threadDelay' $ prev + delay - now
-            action `finally` (putMVar lock =<< getTime Monotonic))
+    mask $ \restore -> do
+        prev <- takeMVar lock
+        now <- getTime Monotonic
+        threadDelay' $ prev + delay - now
+        result <- restore action
+        putMVar lock =<< getTime Monotonic
+        return result
 
 
 threadDelay' :: TimeSpec -> IO ()
diff --git a/nationstates.cabal b/nationstates.cabal
--- a/nationstates.cabal
+++ b/nationstates.cabal
@@ -1,5 +1,5 @@
 name: nationstates
-version: 0.2.0.2
+version: 0.2.0.3
 synopsis: NationStates API client
 description:
     NationStates API client
