Fix for 1.7.8 and up

getTagName was removed, so I just copy+pasted it into here.