Bugs fixed, handle changed matrix.