fix tree bug and minor change