Fix some bugs caused by the typos of variable name and refuctor codes