fix attach crash