handle deleting references