add thread support and resolve some warrnning