Fix tag writing.