implemented restoring connection and support of its losing