modify set matrix zeros and sort list