Fixes warnings
Safely handles forcibly connection losing situation.