detect loop blocks