Use replace for manipulating CourseLocator, so that deprecation is preserved

and here.