corrected path length for recursive method