fix detach
modify few test and add new one