diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index c95a507..3c75eba 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -405,6 +405,13 @@ set_command_line_wait (GeditApp *app,
 }
 
 static void
+set_command_line_wait_gfunc (GeditTab *tab,
+                             GeditApp *app)
+{
+	set_command_line_wait(app, tab);
+}
+
+static void
 open_files (GApplication            *application,
 	    gboolean                 new_window,
 	    gboolean                 new_document,
@@ -474,7 +481,7 @@ open_files (GApplication            *application,
 
 		if (command_line)
 		{
-			g_slist_foreach (loaded, (GFunc)set_command_line_wait, NULL);
+			g_slist_foreach (loaded, (GFunc)set_command_line_wait_gfunc, GEDIT_APP (application));
 		}
 		g_slist_free (loaded);
 	}
diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
index 51477f6..c163084 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -177,7 +177,7 @@ load_file_list (GeditWindow             *window,
 
 			++num_loaded_files;
 			loaded_files = g_slist_prepend (loaded_files,
-			                                gedit_tab_get_document (tab));
+			                                tab);
 		}
 	}
 
@@ -216,7 +216,7 @@ load_file_list (GeditWindow             *window,
 
 			++num_loaded_files;
 			loaded_files = g_slist_prepend (loaded_files,
-			                                gedit_tab_get_document (tab));
+			                                tab);
 		}
 	}
 
@@ -238,7 +238,7 @@ load_file_list (GeditWindow             *window,
 
 			++num_loaded_files;
 			loaded_files = g_slist_prepend (loaded_files,
-			                                gedit_tab_get_document (tab));
+			                                tab);
 		}
 
 		l = g_slist_next (l);
