improved connection management to be more fault-tolerant