Fix image class logic