Fixes sparse matrix max dimension when there are empty columns