fixed issue with duplicate records