Fix bug in Problem 2.