fix and test changes
*fixed disconnecting triggering failedtoconnect event
*fixed some tests