add re-connect logic