Fix issue 3174: do substitution first in evalf_sum()

    N.b.: XFAILed test was changed due to adoption of
    the Karr convention for summation.