Fixing foreach loops.