made average_for_course more defensive