Fixed bug that doesn't clean the linked list