two mode for multithread ok, old mode is faster