Fixed thread not detaching in the native code.  This is a very small fix that is going to cause a rather large structural change.