This looks OK (although pasting the actual script rather than a screenshot would help). Just make sure that you are returning the strTempName to the userID attribute when trying to create the user. IF you don't find one and return strCurNames you'll get that behaviour.
Peter