More improvements and corrections  to password handling