guard establish connection - avoid mem leak [ci skip]