Fix missing code in final chapter and correct some typos