make 'tag' variable local, too

I am not a JS pro, but I don't see a reason why the 'var' was left out here?