Fixing bug in sgml writer