fixed sparsity bug