Made worker more robust to errors.