Fix foreach value to reference