fix some bug in final version