Fix image flatten