optimize for single thread mode and fix a accept bug