fix statistics queries