tested and fixed list processing