bug-fixes to psm1