add minor optimization to newick generation