fix bug with comparing matrices