swap the order of noduplicate check