Fix random IOExceptions that stops agent.
Fix random IOExceptions that stops agent.