restore method used by CLI