Made non-XHTML code path identical to original code.