Fix 2d matrix multiplication and 3d matrix inversion.