Fix some detaching issues