Fixed several encryption issues.