fixed the duplicate insert bug