they had weathered the end of agis 's reign and the first years of the junta , and lodovik had proven invaluable in designing the commission of public safety to moderate and eventually replace the junta 's military rulers .