add attach and unattach