complete version and two bug fixed