updated another treelength function