changed the list to point to NULL at the boundaries