Improve detection of connection losses.