updated check for img