fix issues with not removing obsolete references