[[ Bug 13987 ]] Make sure data refs are destroyed properly
Merge pull request #1505 from runrevali/bugfix-13987

[[ Bug 13987 ]] Make sure data refs are destroyed properly