add duplicate checks to prevent failure