Fixed a bug when 'tag' is undefined.