fixed setting connected flag
examples adjusted to new features of library