Fix of Integrity error when saving