added socket reinitialization after network fail