correct some error and move some setting to GlobalSetting
use factory pattern in command