Changed cal.max and cal.min in cal_img