corrects saving of entities