fix usage of ThreadLocalSingleton.