changed adding caption to image logic