fixed sum(a) bug for sparsemats