Added handling of statistics (#7986).