fix npe
modify the app config
refactor code
Merge pull request #463 from youyong205/master

refactor code