Fix issue where a model's reference would change after saving