Fix attach/detach.