fixing bugs in course offering function