diff --git a/NEWS b/NEWS
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+Changes in 0.7.6:
+
+* Fix a memory-trashing segfault.
+
 Changes in 0.7.5:
 
 * Export all unsafe functions in Unsafe.BLAS.
diff --git a/blas.cabal b/blas.cabal
--- a/blas.cabal
+++ b/blas.cabal
@@ -1,5 +1,5 @@
 name:            blas
-version:         0.7.5
+version:         0.7.6
 homepage:        http://github.com/patperry/blas
 synopsis:        Bindings to the BLAS library
 description:
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.62 for Haskell blas 0.7.
+# Generated by GNU Autoconf 2.62 for Haskell blas 0.7.6.
 #
 # Report bugs to <patperry@stanford.edu>.
 #
@@ -596,8 +596,8 @@
 # Identity of this package.
 PACKAGE_NAME='Haskell blas'
 PACKAGE_TARNAME='haskell-blas'
-PACKAGE_VERSION='0.7'
-PACKAGE_STRING='Haskell blas 0.7'
+PACKAGE_VERSION='0.7.6'
+PACKAGE_STRING='Haskell blas 0.7.6'
 PACKAGE_BUGREPORT='patperry@stanford.edu'
 
 ac_unique_file="blas.cabal"
@@ -1215,7 +1215,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Haskell blas 0.7 to adapt to many kinds of systems.
+\`configure' configures Haskell blas 0.7.6 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1276,7 +1276,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Haskell blas 0.7:";;
+     short | recursive ) echo "Configuration of Haskell blas 0.7.6:";;
    esac
   cat <<\_ACEOF
 
@@ -1361,7 +1361,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Haskell blas configure 0.7
+Haskell blas configure 0.7.6
 generated by GNU Autoconf 2.62
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1375,7 +1375,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Haskell blas $as_me 0.7, which was
+It was created by Haskell blas $as_me 0.7.6, which was
 generated by GNU Autoconf 2.62.  Invocation command line was
 
   $ $0 $@
@@ -3094,38 +3094,23 @@
 
 fi
 
-# BLAS in Apple vecLib library?
+# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
 if test $ax_blas_ok = no; then
-	save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS"
-	as_ac_var=`$as_echo "ac_cv_func_$sgemm" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $sgemm" >&5
-$as_echo_n "checking for $sgemm... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+	as_ac_Lib=`$as_echo "ac_cv_lib_blas_$sgemm" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lblas" >&5
+$as_echo_n "checking for $sgemm in -lblas... " >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lblas  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-/* Define $sgemm to an innocuous variant, in case <limits.h> declares $sgemm.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $sgemm innocuous_$sgemm
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $sgemm (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $sgemm
-
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
    builtin and then its argument prototype would still apply.  */
@@ -3133,13 +3118,6 @@
 extern "C"
 #endif
 char $sgemm ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$sgemm || defined __stub___$sgemm
-choke me
-#endif
-
 int
 main ()
 {
@@ -3169,41 +3147,33 @@
 	 test "$cross_compiling" = yes ||
 	 $as_test_x conftest$ac_exeext
        }; then
-  eval "$as_ac_var=yes"
+  eval "$as_ac_Lib=yes"
 else
   $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	eval "$as_ac_var=no"
+	eval "$as_ac_Lib=no"
 fi
 
 rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
+ac_res=`eval 'as_val=${'$as_ac_Lib'}
 		 $as_echo "$as_val"'`
 	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
+if test `eval 'as_val=${'$as_ac_Lib'}
 		 $as_echo "$as_val"'` = yes; then
-  ax_blas_ok=yes
-	     BLAS_LIBS="-framework vecLib"
-fi
-
-	LIBS="$save_LIBS"
-fi
-
-# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
-if test $ax_blas_ok = no; then
-	as_ac_Lib=`$as_echo "ac_cv_lib_blas_$sgemm" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lblas" >&5
-$as_echo_n "checking for $sgemm in -lblas... " >&6; }
+  as_ac_Lib=`$as_echo "ac_cv_lib_dgemm_$dgemm" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $dgemm in -ldgemm" >&5
+$as_echo_n "checking for $dgemm in -ldgemm... " >&6; }
 if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lblas  $LIBS"
+LIBS="-ldgemm -lblas $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -3217,11 +3187,11 @@
 #ifdef __cplusplus
 extern "C"
 #endif
-char $sgemm ();
+char $dgemm ();
 int
 main ()
 {
-return $sgemm ();
+return $dgemm ();
   ;
   return 0;
 }
@@ -3266,14 +3236,14 @@
 $as_echo "$ac_res" >&6; }
 if test `eval 'as_val=${'$as_ac_Lib'}
 		 $as_echo "$as_val"'` = yes; then
-  as_ac_Lib=`$as_echo "ac_cv_lib_dgemm_$dgemm" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $dgemm in -ldgemm" >&5
-$as_echo_n "checking for $dgemm in -ldgemm... " >&6; }
+  as_ac_Lib=`$as_echo "ac_cv_lib_sgemm_$sgemm" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lsgemm" >&5
+$as_echo_n "checking for $sgemm in -lsgemm... " >&6; }
 if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldgemm -lblas $LIBS"
+LIBS="-lsgemm -lblas $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -3287,11 +3257,11 @@
 #ifdef __cplusplus
 extern "C"
 #endif
-char $dgemm ();
+char $sgemm ();
 int
 main ()
 {
-return $dgemm ();
+return $sgemm ();
   ;
   return 0;
 }
@@ -3336,14 +3306,25 @@
 $as_echo "$ac_res" >&6; }
 if test `eval 'as_val=${'$as_ac_Lib'}
 		 $as_echo "$as_val"'` = yes; then
-  as_ac_Lib=`$as_echo "ac_cv_lib_sgemm_$sgemm" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lsgemm" >&5
-$as_echo_n "checking for $sgemm in -lsgemm... " >&6; }
+  ax_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"
+fi
+
+fi
+
+fi
+
+fi
+
+# BLAS in Intel MKL library?
+if test $ax_blas_ok = no; then
+	as_ac_Lib=`$as_echo "ac_cv_lib_mkl_$sgemm" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lmkl" >&5
+$as_echo_n "checking for $sgemm in -lmkl... " >&6; }
 if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsgemm -lblas $LIBS"
+LIBS="-lmkl  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -3406,32 +3387,43 @@
 $as_echo "$ac_res" >&6; }
 if test `eval 'as_val=${'$as_ac_Lib'}
 		 $as_echo "$as_val"'` = yes; then
-  ax_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"
-fi
-
-fi
-
+  ax_blas_ok=yes;BLAS_LIBS="-lmkl"
 fi
 
 fi
 
-# BLAS in Intel MKL library?
+# BLAS in Apple vecLib library?
 if test $ax_blas_ok = no; then
-	as_ac_Lib=`$as_echo "ac_cv_lib_mkl_$sgemm" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lmkl" >&5
-$as_echo_n "checking for $sgemm in -lmkl... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+	save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS"
+	as_ac_var=`$as_echo "ac_cv_func_$sgemm" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $sgemm" >&5
+$as_echo_n "checking for $sgemm... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lmkl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $sgemm to an innocuous variant, in case <limits.h> declares $sgemm.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $sgemm innocuous_$sgemm
 
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $sgemm (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $sgemm
+
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
    builtin and then its argument prototype would still apply.  */
@@ -3439,6 +3431,13 @@
 extern "C"
 #endif
 char $sgemm ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$sgemm || defined __stub___$sgemm
+choke me
+#endif
+
 int
 main ()
 {
@@ -3468,29 +3467,28 @@
 	 test "$cross_compiling" = yes ||
 	 $as_test_x conftest$ac_exeext
        }; then
-  eval "$as_ac_Lib=yes"
+  eval "$as_ac_var=yes"
 else
   $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	eval "$as_ac_Lib=no"
+	eval "$as_ac_var=no"
 fi
 
 rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
 fi
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
+ac_res=`eval 'as_val=${'$as_ac_var'}
 		 $as_echo "$as_val"'`
 	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_Lib'}
+if test `eval 'as_val=${'$as_ac_var'}
 		 $as_echo "$as_val"'` = yes; then
-  ax_blas_ok=yes
-	     BLAS_LIBS="-lmkl"
+  ax_blas_ok=yes;BLAS_LIBS="-framework vecLib"
 fi
 
+	LIBS="$save_LIBS"
 fi
 
 # BLAS in Alpha CXML library?
@@ -4573,38 +4571,23 @@
 
 fi
 
-# BLAS in Apple vecLib library?
+# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
 if test $ax_blas_ok = no; then
-	save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS"
-	as_ac_var=`$as_echo "ac_cv_func_$sgemm" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $sgemm" >&5
-$as_echo_n "checking for $sgemm... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+	as_ac_Lib=`$as_echo "ac_cv_lib_blas_$sgemm" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lblas" >&5
+$as_echo_n "checking for $sgemm in -lblas... " >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lblas  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-/* Define $sgemm to an innocuous variant, in case <limits.h> declares $sgemm.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $sgemm innocuous_$sgemm
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $sgemm (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $sgemm
-
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
    builtin and then its argument prototype would still apply.  */
@@ -4612,13 +4595,6 @@
 extern "C"
 #endif
 char $sgemm ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$sgemm || defined __stub___$sgemm
-choke me
-#endif
-
 int
 main ()
 {
@@ -4648,41 +4624,33 @@
 	 test "$cross_compiling" = yes ||
 	 $as_test_x conftest$ac_exeext
        }; then
-  eval "$as_ac_var=yes"
+  eval "$as_ac_Lib=yes"
 else
   $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	eval "$as_ac_var=no"
+	eval "$as_ac_Lib=no"
 fi
 
 rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
+ac_res=`eval 'as_val=${'$as_ac_Lib'}
 		 $as_echo "$as_val"'`
 	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
+if test `eval 'as_val=${'$as_ac_Lib'}
 		 $as_echo "$as_val"'` = yes; then
-  ax_blas_ok=yes
-	     BLAS_LIBS="-framework vecLib"
-fi
-
-	LIBS="$save_LIBS"
-fi
-
-# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
-if test $ax_blas_ok = no; then
-	as_ac_Lib=`$as_echo "ac_cv_lib_blas_$sgemm" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lblas" >&5
-$as_echo_n "checking for $sgemm in -lblas... " >&6; }
+  as_ac_Lib=`$as_echo "ac_cv_lib_dgemm_$dgemm" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $dgemm in -ldgemm" >&5
+$as_echo_n "checking for $dgemm in -ldgemm... " >&6; }
 if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lblas  $LIBS"
+LIBS="-ldgemm -lblas $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -4696,11 +4664,11 @@
 #ifdef __cplusplus
 extern "C"
 #endif
-char $sgemm ();
+char $dgemm ();
 int
 main ()
 {
-return $sgemm ();
+return $dgemm ();
   ;
   return 0;
 }
@@ -4745,14 +4713,14 @@
 $as_echo "$ac_res" >&6; }
 if test `eval 'as_val=${'$as_ac_Lib'}
 		 $as_echo "$as_val"'` = yes; then
-  as_ac_Lib=`$as_echo "ac_cv_lib_dgemm_$dgemm" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $dgemm in -ldgemm" >&5
-$as_echo_n "checking for $dgemm in -ldgemm... " >&6; }
+  as_ac_Lib=`$as_echo "ac_cv_lib_sgemm_$sgemm" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lsgemm" >&5
+$as_echo_n "checking for $sgemm in -lsgemm... " >&6; }
 if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldgemm -lblas $LIBS"
+LIBS="-lsgemm -lblas $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -4766,11 +4734,11 @@
 #ifdef __cplusplus
 extern "C"
 #endif
-char $dgemm ();
+char $sgemm ();
 int
 main ()
 {
-return $dgemm ();
+return $sgemm ();
   ;
   return 0;
 }
@@ -4815,14 +4783,25 @@
 $as_echo "$ac_res" >&6; }
 if test `eval 'as_val=${'$as_ac_Lib'}
 		 $as_echo "$as_val"'` = yes; then
-  as_ac_Lib=`$as_echo "ac_cv_lib_sgemm_$sgemm" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lsgemm" >&5
-$as_echo_n "checking for $sgemm in -lsgemm... " >&6; }
+  ax_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"
+fi
+
+fi
+
+fi
+
+fi
+
+# BLAS in Intel MKL library?
+if test $ax_blas_ok = no; then
+	as_ac_Lib=`$as_echo "ac_cv_lib_mkl_$sgemm" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lmkl" >&5
+$as_echo_n "checking for $sgemm in -lmkl... " >&6; }
 if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsgemm -lblas $LIBS"
+LIBS="-lmkl  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -4885,32 +4864,43 @@
 $as_echo "$ac_res" >&6; }
 if test `eval 'as_val=${'$as_ac_Lib'}
 		 $as_echo "$as_val"'` = yes; then
-  ax_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"
-fi
-
-fi
-
+  ax_blas_ok=yes;BLAS_LIBS="-lmkl"
 fi
 
 fi
 
-# BLAS in Intel MKL library?
+# BLAS in Apple vecLib library?
 if test $ax_blas_ok = no; then
-	as_ac_Lib=`$as_echo "ac_cv_lib_mkl_$sgemm" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $sgemm in -lmkl" >&5
-$as_echo_n "checking for $sgemm in -lmkl... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+	save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS"
+	as_ac_var=`$as_echo "ac_cv_func_$sgemm" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $sgemm" >&5
+$as_echo_n "checking for $sgemm... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lmkl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $sgemm to an innocuous variant, in case <limits.h> declares $sgemm.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $sgemm innocuous_$sgemm
 
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $sgemm (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $sgemm
+
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
    builtin and then its argument prototype would still apply.  */
@@ -4918,6 +4908,13 @@
 extern "C"
 #endif
 char $sgemm ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$sgemm || defined __stub___$sgemm
+choke me
+#endif
+
 int
 main ()
 {
@@ -4947,29 +4944,28 @@
 	 test "$cross_compiling" = yes ||
 	 $as_test_x conftest$ac_exeext
        }; then
-  eval "$as_ac_Lib=yes"
+  eval "$as_ac_var=yes"
 else
   $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	eval "$as_ac_Lib=no"
+	eval "$as_ac_var=no"
 fi
 
 rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
 fi
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
+ac_res=`eval 'as_val=${'$as_ac_var'}
 		 $as_echo "$as_val"'`
 	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_Lib'}
+if test `eval 'as_val=${'$as_ac_var'}
 		 $as_echo "$as_val"'` = yes; then
-  ax_blas_ok=yes
-	     BLAS_LIBS="-lmkl"
+  ax_blas_ok=yes;BLAS_LIBS="-framework vecLib"
 fi
 
+	LIBS="$save_LIBS"
 fi
 
 # BLAS in Alpha CXML library?
@@ -6126,7 +6122,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Haskell blas $as_me 0.7, which was
+This file was extended by Haskell blas $as_me 0.7.6, which was
 generated by GNU Autoconf 2.62.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -6175,7 +6171,7 @@
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
-Haskell blas config.status 0.7
+Haskell blas config.status 0.7.6
 configured by $0, generated by GNU Autoconf 2.62,
   with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 
 AC_PREREQ(2.61)
-AC_INIT([Haskell blas], [0.7], [patperry@stanford.edu])
+AC_INIT([Haskell blas], [0.7.6], [patperry@stanford.edu])
 AC_CONFIG_SRCDIR([blas.cabal])
 
 AC_CONFIG_HEADERS([cbits/config.h])
diff --git a/examples/LU.hs b/examples/LU.hs
--- a/examples/LU.hs
+++ b/examples/LU.hs
@@ -1,5 +1,5 @@
 {-# LANGUAGE ScopedTypeVariables #-}
-module LU ( luFactorize ) where
+module LU ( lu, luFactorize ) where
 
 import Data.Elem.BLAS( BLAS3 )
 
@@ -30,6 +30,7 @@
  - L and U are stored in A, and a list of the row swaps are returned.
  - On failure, the index of the failing column is returned.
  -}      
+{-# INLINE luFactorize #-}
 luFactorize :: (WriteMatrix a e m) => a (n,p) e -> m (Either Int [Int])
 luFactorize a
     | mn > 1 =
diff --git a/lib/Data/Matrix/Dense/IOBase.hs b/lib/Data/Matrix/Dense/IOBase.hs
--- a/lib/Data/Matrix/Dense/IOBase.hs
+++ b/lib/Data/Matrix/Dense/IOBase.hs
@@ -54,7 +54,7 @@
                 -> Int          -- ^ offset
                 -> (Int,Int)    -- ^ shape
                 -> IOMatrix (n,p) e
-matrixViewArray f o (m,n) = matrixViewArrayWithLda m f o (m,n)
+matrixViewArray f o (m,n) = matrixViewArrayWithLda (max 1 m) f o (m,n)
 {-# INLINE matrixViewArray #-}
 
 -- | View an array in memory as a matrix, with the given leading dimension
@@ -202,8 +202,8 @@
             ys = vecsB b
         in zipWithM_ f xs ys
         
-    rowViews c = [ unsafeRowViewIOMatrix c i | i <- [ 0..numRows c ] ]
-    colViews c = [ unsafeColViewIOMatrix c j | j <- [ 0..numCols c ] ]
+    rowViews c = [ unsafeRowViewIOMatrix c i | i <- [ 0..numRows c - 1 ] ]
+    colViews c = [ unsafeColViewIOMatrix c j | j <- [ 0..numCols c - 1 ] ]
 
 -- | Perform an 'IO' action with a pointer to the first element of the
 -- matrix.
diff --git a/lib/Data/Vector/Dense/ST.hs b/lib/Data/Vector/Dense/ST.hs
--- a/lib/Data/Vector/Dense/ST.hs
+++ b/lib/Data/Vector/Dense/ST.hs
@@ -10,8 +10,8 @@
 
 module Data.Vector.Dense.ST (
     -- * The @STVector@ data type
-    runSTVector,
     STVector,
+    runSTVector,
     
     -- * Overloaded mutable dense vector interface
     module Data.Vector.Dense.Class
diff --git a/tests/Makefile.in b/tests/Makefile.in
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1,10 +1,10 @@
 
 
 all:
-	ghc --make -fforce-recomp -XScopedTypeVariables -DREAL Main.hs -o test-real
+	ghc --make -package blas-@PACKAGE_VERSION@ -fforce-recomp -XScopedTypeVariables -DREAL Main.hs -o test-real
 	./test-real
 	
-	ghc --make -fforce-recomp -XScopedTypeVariables -DCOMPLEX Main.hs -o test-complex
+	ghc --make -package blas-@PACKAGE_VERSION@ -fforce-recomp -XScopedTypeVariables -DCOMPLEX Main.hs -o test-complex
 	./test-complex
 	
 hpc:
