Fixed a bug with the null checking in tag code