Fixed detaching issue