put to rights

verb

1.
return to its original or usable and functioning condition