added check for images