Improve handling of ThreadStatic collections