altered treeconstruction to fix #71