update to handle unpluggin