fix a bug in chapter 6