Added check to make sure background thread hasn't died, restarts if necessary