linked list: proper error checking