adding basic error handling to linked lists