Solved bug in sparse matrix reduce