Fix bug in grid layout.