improve error on matrix, see #40