re-factoring of thread_local_ptr<>