1. several bug fixed, major bugs in thread version