Fix broken pathfinding and unit tests.