fixed undefined behavior which relied on order of execution in function argument in problem 118.