Fix bugs that caused problems with saving passwords and domain sustitution.