Fix foreach warnings