Chapter 4 bug fixes