Fixed r-diagonal bug, and last column bug