Added return in cal_img