diff --git a/userprog/syscall.c b/userprog/syscall.c
index 98fc8eb0fd70fdde9f1b3f4f4398edd7676cc790..f15f022a83324fc3adcd6e5c1d04f99459f1e79a 100644
--- a/userprog/syscall.c
+++ b/userprog/syscall.c
@@ -90,7 +90,7 @@ syscall_handler (struct intr_frame *f UNUSED)
 static struct list *file_list;
 
 /* Goes through all the files in the file_list and looks for the given file 
- * Descriptor.
+ * Descriptor. Linear search
  */
 void file_search(struct file_map *f) {
 	// Creates a struct to hold the currently checked file
@@ -104,7 +104,7 @@ void file_search(struct file_map *f) {
 		(is_tail(list_element) == false)
 		) {
 		// Swaps the list_element for the next one in place
-		list_next(list_element);
+		list_element = list_next(list_element);
 	}
 	// Copies list_element to current file
 	curr_file->list_element = *list_element;