bug fixes in cohort script