Correcting image reading logic.