Fix buggs from Chapter 5