Index: /trunk/FACT++/src/ConnectionUSB.cc
===================================================================
--- /trunk/FACT++/src/ConnectionUSB.cc	(revision 11920)
+++ /trunk/FACT++/src/ConnectionUSB.cc	(revision 11921)
@@ -18,5 +18,5 @@
 using ba::serial_port_base;
 
-//#define DEBUG_TX
+#define DEBUG_TX
 
     // -------- Abbreviations for starting async tasks ---------
@@ -30,9 +30,9 @@
 }
 
-void ConnectionUSB::AsyncRead(const ba::mutable_buffers_1 buffers, int type)
+void ConnectionUSB::AsyncRead(const ba::mutable_buffers_1 buffers, int type, int counter)
 {
     ba::async_read(*this, buffers,
                    boost::bind(&ConnectionUSB::HandleReceivedData, this,
-                               dummy::error, dummy::bytes_transferred, type));
+                               dummy::error, dummy::bytes_transferred, type, counter));
 }
 
@@ -77,7 +77,10 @@
         Error("Cancel async requests on "+URL()+": "+ec.message());
 
-    close(ec);
-    if (!ec)
-        Error("Closing "+URL()+": "+ec.message());
+    if (IsConnected())
+    {
+        close(ec);
+        if (!ec)
+            Error("Closing "+URL()+": "+ec.message());
+    }
 
     // Reset the connection status
Index: /trunk/FACT++/src/ConnectionUSB.h
===================================================================
--- /trunk/FACT++/src/ConnectionUSB.h	(revision 11920)
+++ /trunk/FACT++/src/ConnectionUSB.h	(revision 11921)
@@ -46,5 +46,5 @@
     // -------- Abbreviations for starting async tasks ---------
 
-    void AsyncRead(const boost::asio::mutable_buffers_1 buffers, int type=0);
+    void AsyncRead(const boost::asio::mutable_buffers_1 buffers, int type=0, int counter=0);
     void AsyncWrite(const boost::asio::const_buffers_1 &buffers);
     void AsyncWait(boost::asio::deadline_timer &timer, int millisec,
@@ -95,5 +95,5 @@
     // ------------------------ others --------------------------
 
-    virtual void HandleReceivedData(const boost::system::error_code&, size_t, int = 0) { }
+    virtual void HandleReceivedData(const boost::system::error_code&, size_t, int = 0, int = 0) { }
     virtual void HandleTransmittedData(size_t) { }
     virtual void HandleReadTimeout(const boost::system::error_code&) { }
