fixes to the list handling code