improve connection error handling
updated to include cheertree.py