make restore_tcsettings a extra function