there is a bug with the head and tail of the linked list