fix thumbnails and preview in PIL