fixed linked list logic