fix database record duplication