Fixed some bugs by Xincheng