fix (or at least work around) #788

I haven't figured out the exception "AttributeError: Plugin instance has no attribute 'encode_password'" (see issue #788), but this commit fixes the small bug of "r" not being defined in case of an exception.