better handling escaped characters in tags