Fix function that resolves nonzero entries in columns