Fix the lack of update of path length when the path changed