Fixed a bug in the password function