improve ConnectionManager.py