fix multithread probelm