Fixed a bug where the dependency graph was traversed in the incorrect order.