changed cv_index to cv_flag