fix duplicate key bug