Converted device2str and control2str to use thread local storage.