diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+2021-02-01 v0.6.3.4
+	* Use env var to get ghc libdir by @jneira
 2020-11-11 v0.6.3.3
 	* Sort comments properly, ignoring SrcSpan's file by @zliu41
 2020-07-16 v0.6.3.2
diff --git a/ghc-exactprint.cabal b/ghc-exactprint.cabal
--- a/ghc-exactprint.cabal
+++ b/ghc-exactprint.cabal
@@ -1,5 +1,5 @@
 name:                ghc-exactprint
-version:             0.6.3.3
+version:             0.6.3.4
 synopsis:            ExactPrint for GHC
 description:         Using the API Annotations available from GHC 7.10.2, this
                      library provides a means to round trip any code that can
diff --git a/src/Language/Haskell/GHC/ExactPrint/Parsers.hs b/src/Language/Haskell/GHC/ExactPrint/Parsers.hs
--- a/src/Language/Haskell/GHC/ExactPrint/Parsers.hs
+++ b/src/Language/Haskell/GHC/ExactPrint/Parsers.hs
@@ -50,13 +50,17 @@
 import Language.Haskell.GHC.ExactPrint.Preprocess
 import Language.Haskell.GHC.ExactPrint.Types
 
+import Control.Exception (IOException, catch)
 import Control.Monad.RWS
 #if __GLASGOW_HASKELL__ > 806
 import Data.Data (Data)
 #endif
+import Data.Maybe (fromMaybe)
 
 import GHC.Paths (libdir)
 
+import System.Environment (lookupEnv)
+
 import qualified ApiAnnotation as GHC
 import qualified DynFlags      as GHC
 #if __GLASGOW_HASKELL__ > 808
@@ -85,6 +89,7 @@
 
 import qualified Data.Map as Map
 
+
 {-# ANN module "HLint: ignore Eta reduce" #-}
 {-# ANN module "HLint: ignore Redundant do" #-}
 {-# ANN module "HLint: ignore Reduce duplication" #-}
@@ -284,9 +289,12 @@
 
 -- | Internal function. Default runner of GHC.Ghc action in IO.
 ghcWrapper :: GHC.Ghc a -> IO a
-ghcWrapper =
+ghcWrapper ghc = do
+  let handler = return . const Nothing :: IOException -> IO (Maybe String)
+  rtLibdir <- liftIO $ lookupEnv "GHC_EXACTPRINT_GHC_LIBDIR" `catch` handler
+  let libdir' = fromMaybe libdir rtLibdir
   GHC.defaultErrorHandler GHC.defaultFatalMessager GHC.defaultFlushOut
-    . GHC.runGhc (Just libdir)
+    . GHC.runGhc (Just libdir') $ ghc
 
 -- | Internal function. Exposed if you want to muck with DynFlags
 -- before parsing.
diff --git a/tests/examples/ghc710/Ppr006a.hs b/tests/examples/ghc710/Ppr006a.hs
new file mode 100644
--- /dev/null
+++ b/tests/examples/ghc710/Ppr006a.hs
@@ -0,0 +1,24 @@
+{-# LANGUAGE QuasiQuotes #-}
+module Ppr006a where
+
+commands :: [Command]
+commands = [
+    command "novisual" "cancel visual selection" $
+      sendEventCurrent EvNoVisual
+
+  -- insert a song right after the current song
+  , command "insert" [help|
+      inserts a song to the playlist. The song is inserted after the currently
+      playing song.
+      |] $ do
+      st <- MPD.status
+      case MPD.stSongPos st of
+        Just n -> do
+          -- there is a current song, insert after
+          sendEventCurrent (EvInsert (n + 1))
+        _ -> do
+          -- there is no current song, just add
+          sendEventCurrent EvAdd
+
+  ]
+
