change query function