Bug fix for lossy connection handling logic