Added error handling for when no cohort is loaded.