Fix bug in generate passwords