Fix foreach order.