double loop problem, next is linked list