diff --git a/Setup.hs b/Setup.hs
--- a/Setup.hs
+++ b/Setup.hs
@@ -60,18 +60,16 @@
 buildFltk prefix = do
   rawSystemExit normal "tar" ["-zxf", fltkSource ++ "-source.tar.gz"]
   projectRoot <- getCurrentDirectory
-  prefix' <- prefix
+  prefix' <- case buildOS of
+               Windows -> prefix >>= cygpath "-u"
+               _ -> prefix
   let fltkDir = projectRoot </>  fltkSource
       fltkFlags = [ "--enable-gl",
                     "--enable-shared",
                     "--enable-localjpeg",
                     "--enable-localzlib",
                     "--enable-localpng",
-                    ("--prefix=" ++ (case buildOS of {
-                                       Windows -> (unsafePerformIO (cygpath "-u" prefix'));
-                                       _ -> prefix'
-                                     }
-                                    ))]
+                    ("--prefix=" ++ prefix')]
   withCurrentDirectory
     fltkDir
     (
@@ -80,33 +78,18 @@
           rawSystemExit normal (fltkDir </> "configure") fltkFlags
           runMake []
           runMake ["install"]
-          updateEnv "DYLD_LIBRARY_PATH" fltkDir
-          updateEnv "DYLD_LIBRARY_PATH" (fltkDir </> "lib")
-          updateEnv "DYLD_LIBRARY_PATH" (fltkDir </> "src")
-          updateEnv "LIBRARY_PATH" (fltkDir </> "lib")
-          updateEnv "PATH" (fltkDir </> "fluid")
-          updateEnv "PATH" fltkDir
+          updateEnv "DYLD_LIBRARY_PATH" (prefix' </> "lib")
+          updateEnv "LIBRARY_PATH" (prefix' </> "lib")
         Windows -> do
           rawSystemExit normal "sh" ([(fltkDir </> "configure")] ++ fltkFlags)
           runMake []
           runMake ["install"]
-          let path = windowsFriendlyPaths fltkDir
-          updateEnv "INCLUDE_PATH" path
-          updateEnv "LD_LIBRARY_PATH" (path </> "lib")
-          updateEnv "LD_LIBRARY_PATH" (path </> "src")
-          updateEnv "LIBRARY_PATH" (path </> "lib")
-          updateEnv "PATH" (path </> "fluid")
-          updateEnv "PATH" path
         _ -> do
           rawSystemExit normal (fltkDir </> "configure") fltkFlags
           runMake []
           runMake ["install"]
-          updateEnv "INCLUDE_PATH" fltkDir
-          updateEnv "LD_LIBRARY_PATH" (fltkDir </> "lib")
-          updateEnv "LD_LIBRARY_PATH" (fltkDir </> "src")
-          updateEnv "LIBRARY_PATH" (fltkDir </> "lib")
-          updateEnv "PATH" (fltkDir </> "fluid")
-          updateEnv "PATH" fltkDir
+          updateEnv "LD_LIBRARY_PATH" (prefix' </> "lib")
+          updateEnv "LIBRARY_PATH" (prefix' </> "lib")
     )
 
 myPreConf :: Args -> ConfigFlags -> IO HookedBuildInfo
@@ -181,15 +164,12 @@
   else s
 
 myBuildHook pkg_descr local_bld_info user_hooks bld_flags = do
-     projectRoot <- getCurrentDirectory
-     let fltkDir = projectRoot </> fltkSource
      let confFlags = configFlags local_bld_info
      if (bundledBuild confFlags)
-     then do
-       p' <- bundlePrefix confFlags "bin"
-       case buildOS of
-          Windows -> updateEnv "PATH" (windowsFriendlyPaths p')
-          _ -> updateEnv "PATH" p'
+     then bundlePrefix confFlags "bin" >>=
+          case buildOS of
+            Windows -> updateEnv "PATH" . windowsFriendlyPaths
+            _ -> updateEnv "PATH"
      else return ()
      let compileC = putStrLn "==Compiling C bindings==" >> runMake []
      cdirexists <- doesDirectoryExist fltkcdir
@@ -215,14 +195,20 @@
                do
                  ghcPath <- rawSystemStdout normal "sh" ["-c", "which ghc"]
                  cppGccPthreadPaths <- mapM (cygpath "-w") (stdCppGccPthreadPaths ghcPath)
+                 bundledInclude <- if (bundledBuild confFlags)
+                                   then (bundlePrefix confFlags) "include" >>= \p -> return [p]
+                                   else return []
+                 bundledLib <- if (bundledBuild confFlags)
+                               then (bundlePrefix confFlags) "lib" >>= \p -> return [p]
+                               else return []
                  let fixedLib = maybe Nothing
                                      (\(ld, incDirs) ->
                                           fmap (\l' -> l' {
                                                    libBuildInfo =
                                                      (libBuildInfo l') {
                                                         PD.ldOptions = fmap windowsFriendlyPaths ld,
-                                                        includeDirs = fmap windowsFriendlyPaths (incDirs ++ (if (bundledBuild confFlags) then [fltkDir] else [])),
-                                                        extraLibDirs = cppGccPthreadPaths ++ (extraLibDirs (libBuildInfo l')) ++ (if (bundledBuild confFlags) then [windowsFriendlyPaths fltkDir] else []),
+                                                        includeDirs = fmap windowsFriendlyPaths (incDirs ++ bundledInclude),
+                                                        extraLibDirs = cppGccPthreadPaths ++ (extraLibDirs (libBuildInfo l')) ++ bundledLib,
                                                         extraLibs = ["stdc++", "gcc", "pthread"]
                                                      }
                                                 })
@@ -240,7 +226,6 @@
          updateEnv "DYLD_LIBRARY_PATH" fltkcdir
          updateEnv "LIBRARY_PATH" fltkcdir
          buildHook autoconfUserHooks pkg_descr local_bld_info user_hooks bld_flags
-
 
 copyCBindingsAndBundledExecutables :: PackageDescription -> LocalBuildInfo -> UserHooks -> CopyFlags -> IO ()
 copyCBindingsAndBundledExecutables pkg_descr lbi uhs flags = do
diff --git a/fltkhs.cabal b/fltkhs.cabal
--- a/fltkhs.cabal
+++ b/fltkhs.cabal
@@ -1,5 +1,5 @@
 name : fltkhs
-version : 0.5.2.1
+version : 0.5.2.2
 synopsis : FLTK bindings
 description:
     Low level bindings for the FLTK GUI toolkit. For installation and quick start instruction please scroll all the way down to the README.
