trick to deal with list end