make map thread safe