Fix/loop detect do loops