Fix matrix issues.