redefine function of query