             guard tableData[1].first(where: isPasswordDelimiterCellData) == nil else {
                 return
             }
-            tableData[1].insert([.type: PasswordEditorCellType.passwordGroupsCell], at: tableData[1].endIndex - 1)
+            tableData[1].insert([.type: PasswordEditorCellType.passwordGroupsCell], at: tableData[1].endIndex)
         case .xkcd:
             tableData[1].removeAll(where: isPasswordDelimiterCellData)
         }

        scanQRCodeCell?.selectionStyle = .default
        scanQRCodeCell?.accessoryType = .disclosureIndicator

        passwordFlavorCell = UITableViewCell(style: .value1, reuseIdentifier: "default")
        passwordFlavorCell?.textLabel?.text = "PasswordGeneratorFlavor".localize()
        passwordFlavorCell?.selectionStyle = .none
        passwordFlavorCell?.accessoryType = .disclosureIndicator
        passwordFlavorCell?.detailTextLabel?.text = passwordGenerator.flavor.localized
    }

    override func viewDidLoad() {


    private func isPasswordDelimiterCellData(data: Dictionary<PasswordEditorCellKey, Any>) -> Bool {
        return (data[.type] as? PasswordEditorCellType) == .some(.passwordGroupsCell)
    }

    @objc func flavorChanged(_ sender: UISegmentedControl) {
        let flavor = PasswordGeneratorFlavor.allCases[sender.selectedSegmentIndex]
        guard passwordGenerator.flavor != flavor else {
            return
        }
        passwordGenerator.flavor = flavor
        updateTableData(withRespectTo: flavor)
        tableView.reloadSections([passwordSection], with: .none)
        generateAndCopyPassword()
    }

    // generate the password, don't care whether the original line is otp
