Fixes NameTree reading

Fixes #2867