fixed race condition on active thread count