diff --git a/src/caps-hash.c b/src/caps-hash.c
index 12aeb30..aaa0fb2 100644
--- a/src/caps-hash.c
+++ b/src/caps-hash.c
@@ -62,7 +62,7 @@ char_cmp (gconstpointer a, gconstpointer b)
   gchar *left = *(gchar **) a;
   gchar *right = *(gchar **) b;
 
-  return strcmp (left, right);
+  return g_strcmp0 (left, right);
 }
 
 static gint
@@ -71,7 +71,7 @@ fields_cmp (gconstpointer a, gconstpointer b)
   DataFormField *left = *(DataFormField **) a;
   DataFormField *right = *(DataFormField **) b;
 
-  return strcmp (left->field_name, right->field_name);
+  return g_strcmp0 (left->field_name, right->field_name);
 }
 
 static gint
@@ -80,7 +80,7 @@ dataforms_cmp (gconstpointer a, gconstpointer b)
   DataForm *left = *(DataForm **) a;
   DataForm *right = *(DataForm **) b;
 
-  return strcmp (left->form_type, right->form_type);
+  return g_strcmp0 (left->form_type, right->form_type);
 }
 
 static void
diff --git a/src/conn-olpc.c b/src/conn-olpc.c
index 8942002..9ff8e61 100644
--- a/src/conn-olpc.c
+++ b/src/conn-olpc.c
@@ -2160,7 +2160,7 @@ update_activities_properties (GabbleConnection *conn,
   for (properties_node = node->children; properties_node != NULL;
       properties_node = properties_node->next)
     {
-      if (strcmp (properties_node->name, "properties") != 0)
+      if (g_strcmp0 (properties_node->name, "properties") != 0)
         continue;
 
       room = lm_message_node_get_attribute (properties_node, "room");
diff --git a/src/connection.c b/src/connection.c
index d293c29..843d292 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -2003,7 +2003,7 @@ connection_disco_cb (GabbleDisco *disco,
 
       for (iter = result->children; iter != NULL; iter = iter->next)
         {
-          if (0 == strcmp (iter->name, "identity"))
+          if (0 == g_strcmp0 (iter->name, "identity"))
             {
               const gchar *category = lm_message_node_get_attribute (iter,
                   "category");
@@ -2014,7 +2014,7 @@ connection_disco_cb (GabbleDisco *disco,
                 /* XXX: should we also check for specific PubSub <feature>s? */
                 conn->features |= GABBLE_CONNECTION_FEATURES_PEP;
             }
-          else if (0 == strcmp (iter->name, "feature"))
+          else if (0 == g_strcmp0 (iter->name, "feature"))
             {
               const gchar *var = lm_message_node_get_attribute (iter, "var");
 
diff --git a/src/disco.c b/src/disco.c
index 42b0870..5af9f9a 100644
--- a/src/disco.c
+++ b/src/disco.c
@@ -607,20 +607,20 @@ item_info_cb (GabbleDisco *disco,
 
   for (feature = result->children; feature; feature = feature->next)
     {
-      if (0 == strcmp (feature->name, "feature"))
+      if (0 == g_strcmp0 (feature->name, "feature"))
         {
           var = lm_message_node_get_attribute (feature, "var");
           if (var)
             g_hash_table_insert (keys, g_strdup (var), NULL);
         }
-      else if (0 == strcmp (feature->name, "x"))
+      else if (0 == g_strcmp0 (feature->name, "x"))
         {
           if (lm_message_node_has_namespace (feature, NS_X_DATA, NULL))
             {
               for (field = feature->children;
                    field; field = field->next)
                 {
-                  if (0 != strcmp (field->name, "field"))
+                  if (0 != g_strcmp0 (field->name, "field"))
                     continue;
 
                   var = lm_message_node_get_attribute (field, "var");
@@ -728,7 +728,7 @@ disco_items_cb (GabbleDisco *disco,
 
   for (iter = result->children; iter; iter = iter->next)
     {
-      if (0 != strcmp (iter->name, "item"))
+      if (0 != g_strcmp0 (iter->name, "item"))
         continue;
 
       item_jid = lm_message_node_get_attribute (iter, "jid");
diff --git a/src/im-channel.c b/src/im-channel.c
index 352aa82..bd6dfc1 100644
--- a/src/im-channel.c
+++ b/src/im-channel.c
@@ -462,7 +462,7 @@ _gabble_im_channel_receive (GabbleIMChannel *chan,
   priv = GABBLE_IM_CHANNEL_GET_PRIVATE (chan);
 
   /* update peer's full JID if it's changed */
-  if (0 != strcmp (from, priv->peer_jid))
+  if (0 != g_strcmp0 (from, priv->peer_jid))
     {
       g_free (priv->peer_jid);
       priv->peer_jid = g_strdup (from);
diff --git a/src/presence-cache.c b/src/presence-cache.c
index 2a06562..7748258 100644
--- a/src/presence-cache.c
+++ b/src/presence-cache.c
@@ -767,7 +767,7 @@ _caps_disco_cb (GabbleDisco *disco,
     {
       const gchar *var;
 
-      if (0 != strcmp (child->name, "feature"))
+      if (0 != g_strcmp0 (child->name, "feature"))
         continue;
 
       var = lm_message_node_get_attribute (child, "var");
@@ -840,7 +840,13 @@ _caps_disco_cb (GabbleDisco *disco,
 
       computed_hash = caps_hash_compute_from_lm_node (query_result);
 
-      if (g_str_equal (waiter_self->ver, computed_hash))
+      if (computed_hash == NULL)
+        {
+          DEBUG ("Unable to compute caps hash for '%s'.", jid);
+          trust = 0;
+          bad_hash = TRUE;
+        }
+      else if (g_str_equal (waiter_self->ver, computed_hash))
         {
           trust = capability_info_recvd (cache, node, handle, caps, trust_inc);
         }
@@ -1111,7 +1117,7 @@ _parse_presence_message (GabblePresenceCache *cache,
   GabblePresence *presence;
 
   presence_node = message->node;
-  g_assert (0 == strcmp (presence_node->name, "presence"));
+  g_assert (0 == g_strcmp0 (presence_node->name, "presence"));
 
   resource = strchr (from, '/');
   if (resource != NULL)
diff --git a/src/presence.c b/src/presence.c
index b5cac6d..a035447 100644
--- a/src/presence.c
+++ b/src/presence.c
@@ -196,7 +196,7 @@ gabble_presence_set_capabilities (GabblePresence *presence,
     {
       Resource *tmp = (Resource *) i->data;
 
-      if (0 == strcmp (tmp->name, resource))
+      if (0 == g_strcmp0 (tmp->name, resource))
         {
           DEBUG ("found resource %s", resource);
 
@@ -232,7 +232,7 @@ _find_resource (GabblePresence *presence, const gchar *resource)
     {
       Resource *res = (Resource *) i->data;
 
-      if (0 == strcmp (res->name, resource))
+      if (0 == g_strcmp0 (res->name, resource))
         return res;
     }
 
diff --git a/src/pubsub.c b/src/pubsub.c
index 3ecd8fd..ce96c29 100644
--- a/src/pubsub.c
+++ b/src/pubsub.c
@@ -70,7 +70,7 @@ gabble_pubsub_event_handler (GabbleConnection *conn, LmMessage *msg,
 
   for (i = pubsub_event_handlers; i->ns != NULL; i++)
     {
-      if (strcmp (i->ns, event_ns) == 0)
+      if (g_strcmp0 (i->ns, event_ns) == 0)
         {
           i->handle_function (conn, msg, handle);
           return TRUE;
diff --git a/src/roomlist-channel.c b/src/roomlist-channel.c
index 94dfe42..ea885cc 100644
--- a/src/roomlist-channel.c
+++ b/src/roomlist-channel.c
@@ -498,8 +498,8 @@ room_info_cb (gpointer pipeline, GabbleDiscoItem *item, gpointer user_data)
   category = item->category;
   type = item->type;
 
-  if (0 != strcmp (category, "conference") ||
-      0 != strcmp (type, "text"))
+  if (0 != g_strcmp0 (category, "conference") ||
+      0 != g_strcmp0 (type, "text"))
     return;
 
   if (!g_hash_table_lookup_extended (item->features,
diff --git a/src/util.c b/src/util.c
index 35fab78..8a9a69d 100644
--- a/src/util.c
+++ b/src/util.c
@@ -642,7 +642,7 @@ lm_message_node_extract_properties (LmMessageNode *node,
       const gchar *value;
       GValue *gvalue;
 
-      if (0 != strcmp (child->name, prop))
+      if (0 != g_strcmp0 (child->name, prop))
         continue;
 
       name = lm_message_node_get_attribute (child, "name");
