add quit thread func modify some bugs