fix bug in cohort sampling