Fix issue causing nodes to be inserted from last to first when templating.