Fix issue with matrix mismatch.