Improved fix for disconnection.