This changes behavior and, I think, introduces a bug: if `$stats` is not an array, execution will continue down to the `foreach` below (and throw an `Invalid argument supplied for foreach()` warning).