fix duplicate query