fix thread error