Handle disconnects/reconnects properly