Fixed issue with incorrect socket state