fixed bug in linked list, initialize pointer to nullptr