Fix thread count handling.