properly emit end on the attach() result