Fixing a bug in list next.