fixes to the matrix code,