fix rapid disconnect/reconnect bug