fixed main.c multi thread support