Corrected if syntax for image checking