Fix wrong result in problem 2