fixed typo + improved password generation logic