Let us take a step back, though, before we learn how G-d will ultimately rectify all wrong and remove it from creation to underscore a couple of points .
The first is that even though G-d willfully allowed for harm, wrongdoing, and imperfection to exist from the first, He still and all never intended for any of that to be a permanent feature of the universe, as we’d learned before . He always meant to “do away with it and to bring on the great rectification afterwards”, as Ramchal reminds us.
But in addition to that let it be understood that G-d also saw to it that the ability for the world at large — and for each one of us individually — to be rectified would never disappear. We simply could not function otherwise; indeed, how could we and the world itself exist if all the wrong and injustice therein and in our own souls held sway forever and could never be set right?
Ramchal thus likens humanity and the world to “a patient” who is ill to be sure, but who indeed “can be healed” ultimately; that is, to something broken that can be repaired . And he makes the point that this then is the universal paradigm: imperfections exist, to be sure, but they “weren’t allowed to exist in order to undo goodness, but rather to serve as an antagonist to it, then to be undone, and for goodness to be restored” in the end.
He then draws an astonishing analogy to our relationship to death, the greatest instance of undoing in our experience. Despite appearances, he makes the point, death also is not an undoing, as we are assured that we will be brought back to life in the end . For even though the body will decompose in the ground, our luz bone always remains intact, and we will be recomposed by means of it . The point is that if our mortality will go by the waysides, then it is clear that all instances of mortal imperfection, flaw, and nullification will prove to be repairable.
The analogy holds true about our state of exile as well, in the course of which we too were cast to the ground and were made to “dwell in darkness like those who are forever dead” (Lamentations 3:6). For, in the end it will be clear that “despite all this, while they are in the land of their enemies, I (G-d) will not despise them nor will I reject them to annihilate them” (Leviticus 26:44), as “I, the L-rd, have not changed; and you, the sons of Jacob, have not reached the end” (Malachi 3:6). For our people will be redone — resurrected en masse.
We are also assured that G-d will never have “second thoughts”, if you will, about our creation. For even though He will expose us to harm and dismay, He will never abandon us, but will merely allow us to undergo trials and tribulations that He knows will ultimately prove to be for our own good, and He will always maintain our being. Like seeds that seem to be undone in the ground and to be lost forever, we too will shoot upward and bloom. We also will prove not have been undone but rather broken and torn to be sure, but then repaired.
All goodness and holiness will endure, despite setbacks. Just as the soul was forced to endure the ordeals of corporeal life but will eventually be restored to its previous glory, we will too. For G-d will not conceal His presence forever. A bit of it here and there has always shone through the darkness to sustain us, to uphold our souls, our beings, and our existence. And it will shine in full glory in the end.
For nothing new will come into being in the course of the resurrection; instead, what had been will be again, bone and flesh, breath and mind, beating heart and soul. As it’s said, “And the L-rd will always lead you, and He will satisfy your soul in drought and strengthen your bones; and you will be like a well-watered garden and like a water-spring whose water does not fail” (Isaiah 58:11).
 See Klallim Rishonim 17 for Kabbalistic references, as well as R’ Friedlander’s Iyyun 32, R’ Goldblatt’s note 6, and R’ Shriki’s notes 92 and 94.
 See 3:6:1 for example and at several points beforehand.
 Though Ramchal doesn’t raise the point here it’s nonetheless true that each one of us is a “patient” — a victim of one moral, sinful lapse or another — and each can be “healed” if we take it upon ourselves to do teshuvah and improve our ways.
 See Ramchal’s Introduction (sect. 2), 2:1, and elsewhere for reference to the resurrection of the dead.
 The luz bone, located at the base of the spine (known as the os coccyx, the “nut” of the spinal column), is indestructible and is the material out of which the body will be resurrected (See Vayikra Rabba 18:1).
Rabbi Yaakov Feldman has translated and commented upon “The Gates of Repentance”, “The Path of the Just”, and “The Duties of the Heart” (Jason Aronson Publishers). His works are available in bookstores and in various locations on the Web.