Fixes to chapter 11 code