Fixes to linked list code