撥亂反正

Etymology
From the :

The character in this phrase is traditionally glossed as  — for instance by  (何休, 129–182 ) and  (顏師古, 581–645 ) — whereas  is interpreted as "disordered; chaotic; upside-down". Alternatively (and rarely), is used as a verb that means "to apply order; to arrange; to manage", and is considered a synonym of  here.

Idiom

 * 1) to bring order out of chaos; to set right what have been thrown into disorder; to restore justice