[FIX] Some improvements in thumbnail generation