fixes for chapter 6 and 8