Fixed warning for foreach