Terminal cwd restoration