fix bug in workthread