Fixing return of handleQuery