cleanup in device initialization