Update cv.R

change the condition of termination