Include stdexcept
fix typo
Make BLAS routines less fragile