Merge "Replace infinite loop with foreach." into mnc-dev