thread-safe bugs,try to make it more stable