Make the thread more resilient to random errors.