More writer fixes, and fix latent problem where #x0A is treated as a comment.