Fixed bugs when upgrading thread modules