Fixing bugs in Exercise 17