correctly determine new IDs from tree operations