better error handling in resetPassword