diff --git a/userprog/syscall.c b/userprog/syscall.c
index a74a83ae5e991ac5c25d6653d59f5d84f103ad8b..c015dd1cccd641dfeaf08f0ed42a1c1f65ebb50d 100644
--- a/userprog/syscall.c
+++ b/userprog/syscall.c
@@ -84,7 +84,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
@@ -98,7 +98,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;