Added proper wrapper detaching for solving issue #58