Fixed a bug in the threading code that would prevent new threads starting.