diff --git a/src/chat_control.py b/src/chat_control.py
index 51977e013..554624cee 100644
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -1232,7 +1232,8 @@ class ChatControl(ChatControlBase):
 	def update_toolbar(self):
 		# Formatting
 		if gajim.capscache.is_supported(self.contact, NS_XHTML_IM) \
-		and not gajim.capscache.is_supported(self.contact, 'notexistant'):
+		and not gajim.capscache.is_supported(self.contact, 'notexistant') \
+		and not self.gpg_is_active:
 			self._formattings_button.set_sensitive(True)
 		else:
 			self._formattings_button.set_sensitive(False)
diff --git a/src/common/connection.py b/src/common/connection.py
index 8561c2f9d..cd7ed005c 100644
--- a/src/common/connection.py
+++ b/src/common/connection.py
@@ -1162,6 +1162,7 @@ class Connection(ConnectionHandlers):
 			fjid = str(session.jid)
 
 		if keyID and self.USE_GPG:
+			xhtml = None
 			if keyID ==  'UNKNOWN':
 				error = _('Neither the remote presence is signed, nor a key was assigned.')
 			elif keyID.endswith('MISMATCH'):