detect loop in LL