Fix bug in gallery thumbnail layout.