bug fixes when saving related models