wrong findPath function. corrected