diff --git a/ChangeLog.md b/ChangeLog.md
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,5 +1,11 @@
 # Changelog for ghc-lib-parser-ex
 
+## 0.20220501 released
+- Update to `ghc-lib-parser-0.20220501`
+
+## 0.20220401 released
+- Update to `ghc-lib-parser-0.20220401`
+
 ## 9.2.0.3 released
 - Fix ghc bounds in auto mode to use ghc-lib not ghc if build compiler ghc-9.2.1 (see [issue](https://github.com/ndmitchell/hlint/issues/1314))
 
diff --git a/ghc-lib-parser-ex.cabal b/ghc-lib-parser-ex.cabal
--- a/ghc-lib-parser-ex.cabal
+++ b/ghc-lib-parser-ex.cabal
@@ -1,6 +1,6 @@
 cabal-version:  1.18
 name:           ghc-lib-parser-ex
-version:        0.20220401
+version:        0.20220501
 description:    Please see the README on GitHub at <https://github.com/shayne-fletcher/ghc-lib-parser-ex#readme>
 homepage:       https://github.com/shayne-fletcher/ghc-lib-parser-ex#readme
 bug-reports:    https://github.com/shayne-fletcher/ghc-lib-parser-ex/issues
diff --git a/src/Language/Haskell/GhclibParserEx/GHC/Driver/Session.hs b/src/Language/Haskell/GhclibParserEx/GHC/Driver/Session.hs
--- a/src/Language/Haskell/GhclibParserEx/GHC/Driver/Session.hs
+++ b/src/Language/Haskell/GhclibParserEx/GHC/Driver/Session.hs
@@ -161,12 +161,14 @@
                          -> IO (Either String DynFlags)
 parsePragmasIntoDynFlags flags (enable, disable) file str =
   catchErrors $ do
-    let opts =
 #if defined (GHCLIB_API_HEAD)
+    let (_, opts) =
           getOptions (initParserOpts flags) (stringToStringBuffer str) file
 #else
+    let opts =
           getOptions flags (stringToStringBuffer str) file
 #endif
+
     -- Important : apply enables, disables *before* parsing dynamic
     -- file pragmas.
     let flags' =  foldl' xopt_set flags enable
