Fixed most pathfinding bugs.