fixed traverse and print for root node, added to test.js