Fix bug

resolve bug of exercise 5 of chapter 3