fixed potential segfault in password handling