some trouble with for each loops