added memory detachment