diff --git a/src/gui-window.c b/src/gui-window.c
index 8a0d2e2abbe95a4d5c5b81e1bf65905b6a9dac4e..32b5e62d39184e35b09fda24bc275b9dfa4c275b 100644
--- a/src/gui-window.c
+++ b/src/gui-window.c
@@ -141,7 +141,7 @@ gui_window_key_pressed_cb (GtkWidget   *sender,
       if (self->course_count > 1) { // that's a little hackish, but works well enough
         const gchar *name = gtk_stack_get_visible_child_name (self->stack);
         for (guint i=0; i<self->course_count; i++) {
-          if (!g_strcmp0 (name, self->courses[i].name)) {
+          if (g_strcmp0 (name, self->courses[i].name) != 0) {
             if (i > 0) { // we don't go before the first element
               const gchar *target_name = self->courses[i-1].name;
               gtk_stack_set_visible_child_name (self->stack, target_name);
diff --git a/src/moodle-provider.c b/src/moodle-provider.c
index 8461e9de1bf7eda1ae2a6b38be56759fe9b0b985..1222ca2f5d30e6d6341f7d9fc7199bb1921ef190 100644
--- a/src/moodle-provider.c
+++ b/src/moodle-provider.c
@@ -199,21 +199,23 @@ moodle_downloaded_file_cb (GInputStream       *is,
     const char *header = soup_message_headers_get_one (headers, "Content-Disposition");
     g_autofree char *real_filename = NULL, *name = NULL;
 
-    if (sscanf (header, "inline;"    " filename=\"%m[^\"]\"", &name) == 1
-     || sscanf (header, "attachment;"" filename=\"%m[^\"]\"", &name) == 1) {
+    if (sscanf (header, "inline;"    " filename=\"%m[^\"]\"", &name) != 1
+     && sscanf (header, "attachment;"" filename=\"%m[^\"]\"", &name) != 1) {
+
+      g_warning ("could not read header '%s' to get the filename\n", header);
+
+    } else { // we could get the file name
 
       real_filename = get_resource_filename (RESOURCE_FILE, 0, name);
       g_autofree gchar *path1 = g_filename_from_uri (real_filename, NULL, NULL);
       g_autofree gchar *path2 = g_filename_from_uri (filename_looked_for, NULL, NULL);
 
-      if (g_strcmp0 (path1, path2)) { // paths are different: make a symlink!
+      if (g_strcmp0 (path1, path2) != 0) { // paths are different: make a symlink!
         g_autoptr (GFile) link_file = g_file_new_for_uri (filename_looked_for);
         g_file_make_symbolic_link (link_file, name, NULL, NULL);
         // name is the name without the path: we want to make a relative link, so that's perfect
       }
 
-    } else {
-      g_warning ("could not read header '%s'\n", header);
     }
 
     write_g_input_stream_to_file (is, real_filename ?: filename_looked_for);