cleaned up and fix bug when tag is subclassed