lots more tests fixed and few bits and pieces of the query stuff fixed.