Fixed component index in grid layout, closes #646.