Fix tag encoding.