fix attach bug