Fixed minor code in build_from_query_report