Fixes to chapter 3 problems