set dependencies when saving (requires further refinements)