fixed code to prevent duplicate registrations for courses