Detect loops in execution