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 =
-    mask $ \restore -> do
-        prev <- takeMVar lock
-        now <- getTime Monotonic
-        threadDelay' $ prev + delay - now
-        result <- restore action
-        putMVar lock =<< getTime Monotonic
-        return result
+    bracketOnError
+        (takeMVar lock)
+        (tryPutMVar lock)
+        (\prev -> do
+            now <- getTime Monotonic
+            threadDelay' $ prev + delay - now
+            action `finally` (putMVar lock =<< getTime Monotonic))
 
 
 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.3
+version: 0.3.0.0
 synopsis: NationStates API client
 description:
     NationStates API client
