multithreading error handling and subprocess changes