Bug in Membership "require invite code"

I seem to have found a bug in the Membership plugin. Follow these steps:

In the admin screens:
1) Set the option "require invite codes" to true.
2) Enter in some random codes.
3) Set the option "remove code once used" to true.

From the logged out user browser:
1) Follow the registration link.
2) Choose a subscription level.
3) Enter in username, email and password (just the first password)
4) Deliberately enter the password verification incorrectly
5) Enter in a valid invite code
6) submit.

Site will give you a warning that passwords don't match.

7) Re-enter same data from above but make sure the passwords match this time
8) Use the same code as before.

Expected: Site allows the code.
Error message:
"Sorry, but we do not seem to have that code on file, please try another."

So in summary, when any validation error occurs, the invite code is no longer valid. This means the user would have to once again ask for another invite code (manual labor, unsatisfied customer, etc.).

Please investigate and let me know if you have a quick fix.