Fixed the A* implementation.