I mean

else

instead of

else if(i==axis)