Fix bug 2737, formatting matrix