fix chapter 3 version of code