Added offline detection.