Fixed some multithread disaster