add disconnection logic