Corrected bug when select_courses was resubmitted with leaves