Improved the performance for clearing reference attributes when the
attribute they reference is deleted.