added isset to check for image error