basic error handling.
fix regression: pwd field now correctly set