fix detach issue