Attach/detach properly