slightly improved handling of small matrices