Creating user with API, secure string not working?

Product: PowerShell Universal
Version: 3.8.8

I have an API that is used to create user accounts. Any time an account is created with this API the password does not work correctly. Here is the splat for the creation

$NewUserSplat = @{
    SamAccountName = $samname;
    GivenName = $Firname
    Surname = $Lastname
    DisplayName = $fullname
    Path = $container;
    AccountPassword = (ConvertTo-SecureString -asplaintext $password -Force -Verbose);
    CannotChangePassword = $false;
    PasswordNeverExpires = $false;
    Enabled = $true;
    name = $fullname;
    department = $building;
    office = $building;
    EmployeeNumber = $empid
    UserPrincipalName = $upn;
    EmailAddress = $upn;
    Description = $description;
    server = $DC;
    ErrorAction = "SilentlyContinue"
$n = 1
        New-ADUser @NewUserSplat -Credential $Cred
    Catch [Microsoft.ActiveDirectory.Management.ADException]
            $fullname = $firname + " " + $Midname.substring(0,$n) + " " + $LastName
            $ = $fullname
            $NewUserSplat.displayname = $fullname
until ($null -ne (Get-ADUser -Filter {sAMAccountName -eq $samname} -server $dc -ErrorAction SilentlyContinue -Credential $Cred))

The user account is succesfully created, but the password assigned to the account does not work. I output to a file every variable used in the splat and they all are populated correctly. The only thing I can think of is that the creation of the secure string does not work.

Any idea?