bug fix attache/detach