Fixed some questionable connection bookkeeping.