Fixing a bug with the query function.