matrix2D.cpp: minor bug fixes