fixing tree printing issue