path find opt, bug fix