Fixed end of list check