Fix issue with getting length of sparse matrices in new check I added.