Improve the analysis and correct bug