some changes in foreach loop