Fixed a bug where tag names could end up with new line characters in them