Update a lot by Xincheng / solve some bugs