Be more careful about decoding base-64 decoded passwords

And update the tests for the case which failed