add retry connection function