finish the code for query task, to debug;