Fixed topological graph traversing in FirmOptimizer.