Fix crash at the end of the list.