added connected and disconnected events