added check for img visibility