The generated tree object was not sorted correctly and had spurious new lines to separate the entries.