diff --git a/hmatrix-gsl.cabal b/hmatrix-gsl.cabal
--- a/hmatrix-gsl.cabal
+++ b/hmatrix-gsl.cabal
@@ -1,5 +1,5 @@
 Name:               hmatrix-gsl
-Version:            0.18.0.1
+Version:            0.18.2.0
 License:            GPL
 License-file:       LICENSE
 Author:             Alberto Ruiz
@@ -23,6 +23,11 @@
     description:    don't link gslcblas
     default:        False
 
+flag disable-default-paths
+    description:    When enabled, don't add default hardcoded include/link dirs by default. Needed for hermetic builds like in nix.
+    default:        False
+    manual: True
+
 library
 
     Build-Depends:      base<5, hmatrix>=0.18, array, vector,
@@ -65,19 +70,21 @@
                         -fno-warn-unused-binds
 
     if os(OSX)
-        extra-lib-dirs: /opt/local/lib/
-        include-dirs: /opt/local/include/
-        extra-lib-dirs: /usr/local/lib/
-        include-dirs: /usr/local/include/
+        if !flag(disable-default-paths)
+            extra-lib-dirs: /opt/local/lib/
+            include-dirs: /opt/local/include/
+            extra-lib-dirs: /usr/local/lib/
+            include-dirs: /usr/local/include/
         extra-libraries: gsl
         if arch(i386)
             cc-options: -arch i386
         frameworks: Accelerate
 
     if os(freebsd)
-       extra-lib-dirs: /usr/local/lib
-       include-dirs: /usr/local/include
-       extra-libraries: gsl
+        if !flag(disable-default-paths)
+            extra-lib-dirs: /usr/local/lib
+            include-dirs: /usr/local/include
+        extra-libraries: gsl
 
     if os(windows)
         extra-libraries: gsl-0
diff --git a/src/Numeric/GSL/Fitting.hs b/src/Numeric/GSL/Fitting.hs
--- a/src/Numeric/GSL/Fitting.hs
+++ b/src/Numeric/GSL/Fitting.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE FlexibleContexts #-}
 
 {- |
@@ -58,6 +59,9 @@
 import Foreign.Ptr(FunPtr, freeHaskellFunPtr)
 import Foreign.C.Types
 import System.IO.Unsafe(unsafePerformIO)
+#if MIN_VERSION_base(4,11,0)
+import Prelude hiding ((<>))
+#endif
 
 -------------------------------------------------------------------------
 
diff --git a/src/Numeric/GSL/ODE.hs b/src/Numeric/GSL/ODE.hs
--- a/src/Numeric/GSL/ODE.hs
+++ b/src/Numeric/GSL/ODE.hs
@@ -152,6 +152,7 @@
                 // sc' // xiv' // ts' )
                 "ode"
         freeHaskellFunPtr fp
+        if (jp /= nullFunPtr) then freeHaskellFunPtr jp else pure ()
         return sol
 
 foreign import ccall safe "ode"
diff --git a/src/Numeric/GSL/Random.hs b/src/Numeric/GSL/Random.hs
--- a/src/Numeric/GSL/Random.hs
+++ b/src/Numeric/GSL/Random.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Numeric.GSL.Random
@@ -30,7 +31,9 @@
     randn
     )
 import System.Random(randomIO)
-
+#if MIN_VERSION_base(4,11,0)
+import Prelude hiding ((<>))
+#endif
 
 type Seed = Int
 
diff --git a/src/Numeric/GSL/gsl-ode.c b/src/Numeric/GSL/gsl-ode.c
--- a/src/Numeric/GSL/gsl-ode.c
+++ b/src/Numeric/GSL/gsl-ode.c
@@ -40,9 +40,9 @@
         case 5 : {T = gsl_odeiv_step_rk2imp; break; }
         case 6 : {T = gsl_odeiv_step_rk4imp; break; }
         case 7 : {T = gsl_odeiv_step_bsimp; break; }
-        case 8 : { printf("Sorry: ODE rk1imp not available in this GSL version\n"); exit(0); }
-        case 9 : { printf("Sorry: ODE msadams not available in this GSL version\n"); exit(0); }
-        case 10: { printf("Sorry: ODE msbdf not available in this GSL version\n"); exit(0); }
+        case 8 : { fprintf(stderr, "Sorry: ODE rk1imp not available in this GSL version\n"); exit(0); }
+        case 9 : { fprintf(stderr, "Sorry: ODE msadams not available in this GSL version\n"); exit(0); }
+        case 10: { fprintf(stderr, "Sorry: ODE msbdf not available in this GSL version\n"); exit(0); }
         default: ERROR(BAD_CODE);
     }
 
@@ -178,11 +178,16 @@
            status = gsl_odeiv2_driver_apply (d, &t, ti, y);
      
            if (status != GSL_SUCCESS) {
-         	  printf ("error in ode, return value=%d\n", status);
-         	  break;
-        	}
-
-//           printf ("%.5e %.5e %.5e\n", t, y[0], y[1]);
+             int k;
+             fprintf(stderr, "error in ode, return value=%d\n", status);
+             fprintf(stderr, "last successful values are:\n");
+             fprintf(stderr, "t = %.5e\n", t);
+             for (k=0; k < xin; k++)
+               {
+                 fprintf(stderr, "y[%d] = %.5e\n", k, y[k]);
+               }
+             break;
+           }
            
            for(j=0; j<xin; j++) {
                solp[i*xin + j] = y[j];
