fix relayout bug on gallery