Fixing issue on errors with duplicate Id