prevent crashes when creating thumbnails for large images