modify the zstring to thread safe