bugfix for stats queries