Fixed some bad connection restoration logic.