Use correct function to calculate the path distance
Fix problem with definition of RSL and LSR paths