backport Lapack error handling to 1.7.x