fixed error in pathfinding