Fixed yet another bug in path gen algorithm.