Set the correct tree ID for root nodes

Fixes #23