Detail, you got an error if units_info was empty
Now loop throw course_units instead of units_info