chapter9 finished
fix some bugs