fix stat query