diff --git a/embed/ephy-base-embed.c b/embed/ephy-base-embed.c
index a3e3b6c..a51f4a9 100644
--- a/embed/ephy-base-embed.c
+++ b/embed/ephy-base-embed.c
@@ -1096,9 +1096,7 @@ update_net_state_message (EphyBaseEmbed *embed, const char *uri, EphyEmbedNetSta
   }
 
  out:
-  if (host != NULL) {
     g_free (host);
-  }
 }
 
 static void
@@ -1273,7 +1271,7 @@ ephy_base_embed_file_monitor_cancel (EphyBaseEmbed *embed)
     {
       g_file_monitor_cancel (G_FILE_MONITOR (priv->monitor));
     }
-    if (G_IS_DIRECTORY_MONITOR (priv->monitor))
+    else if (G_IS_DIRECTORY_MONITOR (priv->monitor))
     {
       g_directory_monitor_cancel (G_DIRECTORY_MONITOR (priv->monitor));
     }
@@ -1323,7 +1321,7 @@ ephy_base_embed_file_monitor_reload_cb (EphyBaseEmbed *embed)
 static void
 ephy_base_embed_file_monitor_process_event (GFile *file,
                                             gboolean uri_is_directory,
-                                            gint event_type,
+                                            GFileMonitorEvent event_type,
                                             EphyBaseEmbed *embed)
 {
   gboolean should_reload;
@@ -1379,7 +1377,7 @@ static void
 ephy_base_embed_directory_monitor_cb (GDirectoryMonitor *monitor,
                                       GFile *child,
                                       GFile *other_child,
-                                      gint event_type,
+                                      GFileMonitorEvent event_type,
                                       EphyBaseEmbed *embed)
 {
   ephy_base_embed_file_monitor_process_event (child, TRUE, event_type, embed);
@@ -1389,7 +1387,7 @@ static void
 ephy_base_embed_file_monitor_cb (GFileMonitor *monitor,
                                  GFile *file,
                                  GFile *other_file,
-                                 gint event_type,
+                                 GFileMonitorEvent event_type,
                                  EphyBaseEmbed *embed)
 {
   ephy_base_embed_file_monitor_process_event (file, FALSE, event_type, embed);
@@ -1434,7 +1432,7 @@ ephy_base_embed_update_file_monitor (EphyBaseEmbed *embed,
     LOG ("Installed monitor for directory '%s'", address);
     priv->monitor = G_OBJECT (monitor);
   }
-  if (file_type == G_FILE_TYPE_REGULAR)
+  else if (file_type == G_FILE_TYPE_REGULAR)
   {
     GFileMonitor *monitor;
     monitor = g_file_monitor_file (file, 0, NULL);
diff --git a/embed/ephy-favicon-cache.c b/embed/ephy-favicon-cache.c
index 0265659..eab7e16 100644
--- a/embed/ephy-favicon-cache.c
+++ b/embed/ephy-favicon-cache.c
@@ -871,5 +871,7 @@ ephy_favicon_cache_clear (EphyFaviconCache *cache)
 	{
 		delete_file (dir, file_info);
 		file_info = g_file_enumerator_next_file (file_enum, NULL, NULL);
+		g_object_unref (file_info);
 	}
+	g_file_enumerator_close (file_enum, NULL, NULL);
 }
diff --git a/embed/ephy-history.c b/embed/ephy-history.c
index 3e3801a..1ef1092 100644
--- a/embed/ephy-history.c
+++ b/embed/ephy-history.c
@@ -752,14 +752,9 @@ internal_get_host (EphyHistory *eh, const char *url, gboolean create)
 		ephy_history_host_visited (eh, host, now);
 	}
 
-	if (scheme != NULL)
-	{
-		g_free (scheme);
-	}
-	if (host_name != NULL)
-	{
-		g_free (host_name);
-	}
+	g_free (scheme);
+	g_free (host_name);
+
 	g_list_foreach (host_locations, (GFunc)g_free, NULL);
 	g_list_free (host_locations);
 
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
index 821a64d..48976dc 100644
--- a/lib/ephy-file-helpers.c
+++ b/lib/ephy-file-helpers.c
@@ -29,6 +29,7 @@
 #include "eel-gconf-extensions.h"
 #include "eel-app-launch-context.h"
 #include "ephy-debug.h"
+#include "ephy-string.h"
 
 #include <glib.h>
 #include <glib/gi18n.h>
@@ -41,10 +42,7 @@
 #undef GNOME_DISABLE_DEPRECATED
 #include <libgnome/gnome-desktop-item.h>
 
-#define SN_API_NOT_YET_FROZEN
-#include <libsn/sn.h>
 #include <gdk/gdk.h>
-#include <gdk/gdkx.h>
 #include <gtk/gtkrecentmanager.h>
 
 #include <string.h>
@@ -127,7 +125,7 @@ ephy_file_downloads_dir (void)
 char *
 ephy_file_get_downloads_dir (void)
 {
-	char *download_dir;
+	char *download_dir, *expanded;
 
 	download_dir = eel_gconf_get_string (CONF_STATE_DOWNLOAD_DIR);
 
@@ -160,7 +158,10 @@ ephy_file_get_downloads_dir (void)
 
 	g_return_val_if_fail (download_dir != NULL, NULL);
 
-	return download_dir;
+	expanded = ephy_string_expand_initial_tilde (download_dir);
+	g_free (download_dir);
+
+	return expanded;
 }
 
 char *
@@ -633,12 +634,15 @@ ephy_file_launch_desktop_file (const char *filename,
 	GDesktopAppInfo *app;
 	GFile *file;
 	GList *list = NULL;
+	gboolean ret;
 
 	app = g_desktop_app_info_new (filename);
 	file = g_file_new_for_path (parameter);
 	list = g_list_append (list, file);
 	
-	return ephy_file_launch_application (G_APP_INFO (app), list, user_time, widget);
+	ret = ephy_file_launch_application (G_APP_INFO (app), list, user_time, widget);
+	g_list_free (list);
+	return ret;
 }
 
 gboolean
diff --git a/lib/ephy-node-db.c b/lib/ephy-node-db.c
index 6b7bfa1..15a4593 100644
--- a/lib/ephy-node-db.c
+++ b/lib/ephy-node-db.c
@@ -509,6 +509,8 @@ ephy_node_db_write_to_xml_safe (EphyNodeDb *db,
 
 failed:
 	g_free (tmp_file_path);
+	g_object_unref (file);
+	g_object_unref (tmp_file);
 
 	return ret;
 }
diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c
index 4a596d8..242cd00 100644
--- a/src/bookmarks/ephy-bookmark-action.c
+++ b/src/bookmarks/ephy-bookmark-action.c
@@ -372,8 +372,7 @@ ephy_bookmark_action_activate (EphyBookmarkAction *action,
 
 		scheme = g_uri_get_scheme (location);
 		host_name = ephy_string_get_host_name (location);
-		address = g_strconcat (
-				       scheme,
+		address = g_strconcat (scheme,
 				       "://",
 				       host_name,
 				       NULL);
diff --git a/src/ephy-main.c b/src/ephy-main.c
index f0f7f79..f378ce0 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -205,6 +205,10 @@ handle_email (GtkAboutDialog *about,
 	char *command, *handler;
 	GAppInfo *appinfo;
 
+	if (eel_gconf_get_boolean ("/desktop/gnome/url-handlers/mailto/enabled") == FALSE)
+	{
+		return;
+	}
 	/* FIXME: better use g_app_info_get_default_for_uri_scheme () when it is
 	 * implemented.
 	 */
diff --git a/src/window-commands.c b/src/window-commands.c
index b3b2eff..bf15966 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -124,6 +124,12 @@ window_cmd_file_send_to	(GtkAction *action,
 	char *handler, *command;
 	const char *location, *title;
 	GAppInfo *appinfo;
+	
+	if (eel_gconf_get_boolean ("/desktop/gnome/url-handlers/mailto/enabled") == FALSE)
+	{
+		/* FIXME: add some UI to inform the user? */
+		return;
+	}
 
 	embed = ephy_embed_container_get_active_child 
           (EPHY_EMBED_CONTAINER (window));
