fix bug in report query