LPS-48932 Proper reference cleaning and proper visibility for references inyection