fixed bugs in course_add and addressed overflow issue