Fix indices in matrix export.