Complex objective function

hi

I have objective function:
minimize ((a)(norm(Vx - v,2)) + (1-a)(sum(Rp) + sum(Rn)))
Vx and a are constants.

This works fine for values of a other than zero, but when a is zero it starts behaving strange. It works if I add an if statement to the objective, lilke:
if a == 0
minimize (sum(Rp) + sum(Rn))
else
minimize ((a)(norm(Vx - v,2)) + (1-a)(sum(Rp) + sum(Rn)))
end

This is basically the same as above. I do not understand why it works with an if statement but not without it.
Can anyone please explain this? Thanks in advance.