Bug fixes to StudyBuilder