fix build with thread_local