Lab 4, problem 2 bug fix