Fixed issues with encryption