fix ref on delete