Fix arithmetic error in queue query.