fix: free the adapter when detached