name2_tree may be NULL

and do checks if there's only one sub-section
Revert to working code