Fixed corrupted linked list bug