use thread to accelerate the loading speed and fix some bugs