let attach_detach_mode = ref false