added code for disconnectAndResubscribe