revise some code of chap3