Fixed a bug with thumbnails (which needs better testing)