Fix stack trace on disconnect and update examples