remove redundant row and col, replace with dim