Fix stats queries