better error handling, fix *major* bug which could result in different password