c_testquery: more cleanup