major changes in password script to make it compatible to d8