fix a few bugs in user management scripts