Password expiration function bug fixes