fixes to doctype save