Fix duplicate query