Improved error handling for EncryptText and ReadUsernameXML