probably fixed detaching issue (still needs testing)