Fix deinitialization of dag node
Add missing NULL-check
Fix handling of completely new dag tab trees
Rewrite add_roots_for()
Make depth a signed value
Remove old unused static function
Adapt destruct_tab_node()
Rewrite tab node removal function
Fix flatten_tab()