fixed detach usage to work asynchronously