Fixed a bug causing cornered edges to be incorrectly positioned in the matrix mode.