Issue #11 : Fixing bugs on connection/deconnection