added hook to create nonexistent dirs when saving