* fix some static analyzer warnings * fix some static analyzer warnings * fix race condition of workthread control