Fixed main statistics query bug. Incomplete data was returned.