Improve the thumbnail detection