Fix bug causing infintie loop when remote end dies unexpectedly