BF: fix error saving zero entries in sparse matrix

I assumed obj.size was the same as np.prod(obj.shape), but this isn't so for
sparse matrices.  Fix and test.

Closes gh-2700