Refine the bug of path length