Fix enrol coursebox and remove some unnecessary code