solved another linked-list problem