Fix connection restore routine