matrix classes fixed