changed logic of socket disconnect reconnect