add some code for control in work thread