Fixed a bug in the drawMatrix method